ualbertalib / acts_as_rdfable

MIT License
0 stars 1 forks source link

Refactor code in ActsAsRDFable #17

Open murny opened 1 year ago

murny commented 1 year ago

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

I see a few improvements:

pgwillia commented 1 year ago

Is this where the serialization code is used? https://github.com/ualbertalib/oaisys/blob/4d0f657480658343ba01cfe39f71ef0060ccdcab/app/views/oaisys/pmh/list_records.xml.builder#L33

murny commented 1 year ago

Looks like your right! Will remove that bullet 👍

pgwillia commented 1 year ago

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

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

murny commented 1 year ago

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 🤔