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

Implement compatibility with the active_enum gem #68

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

lowjoel
Copy link
Contributor

@lowjoel lowjoel commented May 25, 2014

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!

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.81%) when pulling ef7bf66 on lowjoel:lowjoel-active_enum-compat into 476e02e on hzamani:master.

@lowjoel
Copy link
Contributor Author

lowjoel commented Jul 15, 2014

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?
They're all merged in my master branch.

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.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.81%) when pulling 4a6992f on lowjoel:lowjoel-active_enum-compat into 476e02e on hzamani:master.

@hzamani
Copy link
Owner

hzamani commented Jul 16, 2014

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?

@lowjoel
Copy link
Contributor Author

lowjoel commented Jul 16, 2014

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?

lowjoel added 5 commits July 19, 2014 13:53
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
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.81%) when pulling 7df1858 on lowjoel:lowjoel-active_enum-compat into 3b51a28 on hzamani:master.

@lowjoel
Copy link
Contributor Author

lowjoel commented Jul 19, 2014

@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?

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.36%) when pulling dcac4d6 on lowjoel:lowjoel-active_enum-compat into 3b51a28 on hzamani:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.36%) when pulling dcac4d6 on lowjoel:lowjoel-active_enum-compat into 3b51a28 on hzamani:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.36%) when pulling d93a6e7 on lowjoel:lowjoel-active_enum-compat into 3b51a28 on hzamani:master.

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

Successfully merging this pull request may close these issues.

3 participants