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
String attribute isn't marked as dirty, when it changes with <<
#6954
Comments
Exactly, this is how it works. Rails knows you're changing something when you set the attribute value, there's no way for Rails to know that you're doing a change on the same string. This means that, when using things like Using your example: > cc.tags << " another"
=> " health style another"
> cc.tags_changed?
=> false
> cc.tags_will_change!
=> nil
> cc.tags_changed?
=> true Thanks! |
@carlosantoniodasilva You've explained current realization, but probably is there a chance to change this behavior, wdyt? |
There's no way to change the behavior, unless we wrap all core ruby objects. Rails has no way to know you're changing a string in place, unless we create a |
Thanks for explanation! |
No problem :) |
Rails 3.2.6
The text was updated successfully, but these errors were encountered: