This project is archived and is in readonly mode.
Dirty Attributes and string manipulation
-
Ivan Torres (mexpolk)
- Tag changed from rails 2.3.8, activerecord, dirty to rails 2.3.8, activerecord, dirty, rails3
You're right, the strangest thing is that the original value is lost:
@project.title_was => "helloWorld"
Also this affects Rails 3
-
Ivan Torres (mexpolk)
Doing some tests it turns out that if the String instance is the same, then the change is not detected. If the string is another instance it works as expected:
# This wont work @project.title => "Rails" @project.title << " test" => "Rails test" @project.title_was => "Rails test" @project.title_changed? => false # This works @project.reload @project.title += " test" => "Rails test" @project.title_was => "Rails" @project.title_changed? => true -
Neeraj Singh
- State changed from new to invalid
- Importance changed from to Low
Here is your answer.
http://github.com/lifo/docrails/commit/1a6d76223bf6a022a5755e645742...