-
Notifications
You must be signed in to change notification settings - Fork 58
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
Implement compatibility with the active_enum gem #68
base: master
Are you sure you want to change the base?
Conversation
Hello @hzamani, I have a bunch of fixes like these, where certain ActiveRecord methods are used by other gems. I'd like to ensure compatibility with those gems, but mixing them in the acts_as_relation gems seems nasty. Any ideas how we can support this use-case while not polluting our own gem? Case in point: I have another branch that implements some compatibility for Simple Form's form field deduction when a field is inherited from the superclass. |
Best way seems to have a 'acts-as-relation-compatibility' gem and add compatibility features there. However it don't seem to be a good idea to merge these features here, isn't it? |
I think it doesn't make sense, yes. But at this point there isn't enough extension points that the gem can hook into. Any way to factor out the calls in the main gem so that other gems can add methods to be run either via alias_method or by overriding? |
Conflicts: lib/active_record/acts_as_relation.rb Conflicts: lib/active_record/acts_as_relation/access_methods.rb
…merated attributes but the subclass does. Conflicts: lib/active_record/acts_as_relation.rb
Conflicts: lib/active_record/acts_as_relation.rb
…bility with other gems.
@hzamani I've factored out the call such that everything is in define_acts_as_forwarders. Currently I've not pulled out the active_enum code yet, but my idea is that we can let gems interoperate with acts_as_relation by overriding define_acts_as_forwarders using alias_method_chain. Do you think this is okay? |
This implements some compatibility with Active Enum.
The code probably isn't as clean as it can be; let me know how to improve. Thanks!