This project is archived and is in readonly mode.
Marking Activerecord object as dirty
Reported by geroldboehler | March 30th, 2010 @ 12:31 PM
Hi all,
I just tried the following:
c = Content.find(1)
c.text => "foo"
c.text.sub!("bar")
c.save!
I think people would assume that the record gets saved to the
database - but it doesn't.
Is this behavior correct?
Gerold
Comments and changes to this ticket
-
Jerry Cheung March 30th, 2010 @ 01:42 PM
ActiveRecord::Dirty keeps track of changes through the '=' operator for the attribute. You can use the attr_will_change! method to specify if a attribute will be modified in place. There's an example at: http://ryandaigle.com/articles/2008/3/31/what-s-new-in-edge-rails-d...
-
Tanel Suurhans April 19th, 2010 @ 08:20 PM
I suppose it would be too costly do have some kind of a diff logic run before the call to save, to see if some attributes have changed?
-
gnufied April 21st, 2010 @ 05:37 AM
- Tag set to rails3 arel, invalid
-
gnufied April 21st, 2010 @ 07:14 PM
- Assigned user set to Pratik
-
Jeremy Kemper April 25th, 2010 @ 12:47 AM
- State changed from new to wontfix
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>