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

private method `attribute_was' called error #70

Closed
bbtfr opened this issue Jul 13, 2014 · 3 comments
Closed

private method `attribute_was' called error #70

bbtfr opened this issue Jul 13, 2014 · 3 comments
Labels

Comments

@bbtfr
Copy link
Contributor

bbtfr commented Jul 13, 2014

In new version 2.0, I found that simple_enum use attribute_changed? & attribute_was to check if source attribute is changed.

But according to apidock, attribute_changed? & attribute_was are private method both in active_record & active_model since rails 2.3.

For me, with rails 4.0, attribute_was doesn't work, and I got a error.

private method `attribute_was' called
lwe added a commit that referenced this issue Jul 13, 2014
In Rails 4.0.x the AM::Dirty methods are private, thus the error

> private method `attribute_was' called

is raised when using #was or #changed? on the accessor. Fixed this
by making use uf #send to call the private methods. Starting with
4.1 these methods are public.
@lwe lwe added the bug label Jul 13, 2014
@lwe
Copy link
Owner

lwe commented Jul 13, 2014

Thanks for the report, was able to confirm and fix this. The issue was that it only appears in 4.0.x and not in 4.1 (the APIs were made public). Changed the dirty code to make use of send() to call the private APIs. Any chance you can test the branch if this solves your problem?

@bbtfr
Copy link
Contributor Author

bbtfr commented Jul 14, 2014

It works, thanks.

@bbtfr bbtfr closed this as completed Jul 14, 2014
lwe added a commit that referenced this issue Jul 14, 2014
use #send() to not raise error #70
@lwe
Copy link
Owner

lwe commented Jul 14, 2014

FYI released 2.0.1 with the fix to rubygems.

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

No branches or pull requests

2 participants