-
Notifications
You must be signed in to change notification settings - Fork 7
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
immutable_attributes breaks ActiveRecord exists method #1
Comments
When you remove the plugin does the error go away? I can't see how this plugin would affect the exists? method. I'm using Rails 2.3.5 and it's working fine for me. The objects get instantiated and the setter methods (@model.myattr = 'x') never gets called. Can you check that this code works when you remove the plugin? How about if the plugin is installed but the "attr_immutable" call is commented out? |
Also: thanks for reporting this :) If this is a bug then it means you're solving a problem I was bound to run into myself one day. |
It definitely went away after removing the plugin. I wasn't using attr_immutable, just the validator method. |
You're absolutely right, I wasn't testing with #exists? and the validator method. I've fixed it, pushed the changes, and released a new gem version. Thanks for all your help! |
The presence of this plugin on one of my models seems to be breaking the AR exists? method. I think it's because exists only selects IDs, and when AR tries to instantiate objects with only the ID present, immutable_attributes freaks out.
In this example mymodel is the model and myattr is the immutable attribute, and also the attribute I'm passing to exists?, like so: MyModel.exists?(:myattr => 'foo').
The text was updated successfully, but these errors were encountered: