Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor code in ActsAsRDFable #17

Open
murny opened this issue Oct 19, 2023 · 4 comments
Open

Refactor code in ActsAsRDFable #17

murny opened this issue Oct 19, 2023 · 4 comments

Comments

@murny
Copy link
Contributor

murny commented Oct 19, 2023

It appears there may be some low-hanging fruit for quick refactors and improvements to this gem.

I see a few improvements:

  • Can we simplify the metaprogramming in ActsAsRdfableCore?
  • What is the purpose of add_annotation_bindings! when all models currently include this gem? Is it a good idea to make all models include this gem?
  • Maybe look at other gems in the wild that do a model DSL for inspiration
  • Is there anything that could be removed/simplified? E.g using ActiveSupport::Configurable instead of our own code inside config.rb
@pgwillia
Copy link
Member

@murny
Copy link
Contributor Author

murny commented Oct 19, 2023

Looks like your right! Will remove that bullet 👍

@pgwillia
Copy link
Member

add_annotation_bindings! is used to add the methods to ActiveStorage::Blob, I think 🤔

https://github.com/ualbertalib/jupiter/blob/6da5d4f5cde4f2d6f81b3f1a37d9747849cc6644/app/controllers/aip/v1/entities_controller.rb#L109

@murny
Copy link
Contributor Author

murny commented Oct 19, 2023

Yeah, it's being used in a few places, but I'm not sure why?

E.g ActiveStorage::Blob inherits from ActiveRecord::Base, therefore it would get acts_as_rdfable included via lib/acts_as_rdfable/active_record.rb which includes ActsAsRDFable into all ActiveRecord::Base

Basically, we got two different ways to include this gem, which seems odd. Unless this gem is being used with a "non-active record" class 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants