-
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
Finders with hash attributes are not supported #36
Comments
When useign hash conditions you have to use association key to specify the model, something like this: SubModel.find_or_create_by(supermode: {attribute: value}) And thats why We may fix this (or at fix least |
Going from Rails 4.0 to 4.1, I had to change from using the superclass singular association key name to using the plural superclass table name:
Changed to
|
… Rails 4.0 and 4.1
fixed in |
This works:
SubModel.where("attribute = ?", value)
This does not:
SubModel.where(attribute: value)
And I guess that is also related to why this is not supported:
SubModel.find_or_create_by(attribute: value)
It's not crucial, since there are workarounds, but it forces me to write my code in a way I wouldn't normally do. Hashes are simply more elegant.
The text was updated successfully, but these errors were encountered: