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

enabled_for_model? returns true on every ActiveRecord #438

Closed
durandom opened this issue Oct 30, 2014 · 4 comments
Closed

enabled_for_model? returns true on every ActiveRecord #438

durandom opened this issue Oct 30, 2014 · 4 comments
Milestone

Comments

@durandom
Copy link

as the title says, calling MyModel.enabled_for_model? returns true for all Classes that inherit from ActiveRecord::Base

Is this the intended behavior?

@batter
Copy link
Collaborator

batter commented Oct 30, 2014

Yes, unless you turn it off on a per class basis. Are you suggesting that it should return false unless has_paper_trail is declared on the model in question?

@durandom
Copy link
Author

I think this would be the least surprise.
How else would you check if has_paper_trail was declared on the model?
Right now I do this: MyModel.respond_to?(:version_association_name)

@batter
Copy link
Collaborator

batter commented Oct 31, 2014

Right, you can actually do something like this what the be_versioned matcher for RSpec does, but I see what you're saying and it makes sense to me. Or you could actually do MyModel.include?(PaperTrail::Model::InstanceMethods).

@batter batter added this to the 3.1.0 milestone Oct 31, 2014
@batter batter closed this as completed in be5f192 Oct 31, 2014
@durandom
Copy link
Author

durandom commented Nov 3, 2014

awesome. thanks for your support and suggestions.

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