This project is archived and is in readonly mode.
ActiveRecord::record_timestamps broken in RC2 (regression from RC1)
Just noticed that
false no longer prevents timestamps from being updated. This
is a regression in RC2; the issue was not present in RC1.
Demo using an "Article" mode in a
>> a=Article.first Article Load (0.2ms) SELECT `articles`.* FROM `articles` LIMIT 1 >> Article.record_timestamps => true >> Article.record_timestamps = false => false >> Article.record_timestamps => false >> a.public = false => false >> a.save SQL (0.2ms) UPDATE `articles` SET `public` = 0, `updated_at` = '2010-08-24 12:25:58' WHERE (`articles`.`id` = 1)
Same bug occurs when setting the
>> ActiveRecord::Base.record_timestamps => true >> ActiveRecord::Base.record_timestamps = false => false >> a=Article.first Article Load (0.2ms) SELECT `articles`.* FROM `articles` LIMIT 1 >> a.public=true => true >> a.save SQL (0.2ms) UPDATE `articles` SET `public` = 1, `updated_at` = '2010-08-24 12:27:11' WHERE (`articles`.`id` = 1)
Going to use
git bisect to see if I can locate the
bad commit. There are a couple of candidates I can see in the
history that touch code in the
Will post back once I've found the commit.
Comments and changes to this ticket
- Assigned user set to José Valim
git bisectreveals that this commit is the culprit:
30ea923040ded944209c98383389b6c9aafe806a is the first bad commit commit 30ea923040ded944209c98383389b6c9aafe806a Author: José Valim <firstname.lastname@example.org> Date: Thu Aug 12 12:04:16 2010 -0300 Make update_attribute behave as in Rails 2.3 and document the behavior intrinsic to its implementation. :040000 040000 22165ee5875272a3e985c8fec168483b2c885a89 2ec79fa40b23c189cad633ae076204835fda4e83 M activerecord
The fix is simple:
We are missing a parenthesis there. Just waiting for the test case to fix it (feel free to include the fix in your patch as well!).
- State changed from open to resolved
(from [6ef60bd9ffff44187b3016d00923835a609293bf]) Ensure timestamps are not generated when explicitly set to false [#5440 state:resolved] http://github.com/rails/rails/commit/6ef60bd9ffff44187b3016d0092383...
(from [c857bd23c0ee6f0368a75fe608faed9bbdf1a415]) Ensure timestamps are not generated when explicitly set to false [#5440 state:resolved] http://github.com/rails/rails/commit/c857bd23c0ee6f0368a75fe608faed...
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>