Created
August 16, 2012 07:34
-
-
Save lulalala/3368106 to your computer and use it in GitHub Desktop.
Need to reset change twice for it to be marked unchanged
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>> t = Topic.find(47083); time = t.event.end | |
Topic Load (9.2ms) SELECT `topics`.* FROM `topics` WHERE `topics`.`id` = 47083 LIMIT 1 | |
Topic::Event Load (0.5ms) SELECT `periods`.* FROM `periods` WHERE `periods`.`type` IN ('Topic::Event') AND `periods`.`owner_id` = 47083 AND `periods`.`owner_type` = 'Topic' LIMIT 1 | |
=> Thu, 16 Aug 2012 09:00:04 CST +08:00 | |
>> t.event.changed? | |
=> false | |
>> t.event.end = time + 1.second | |
=> Thu, 16 Aug 2012 09:00:05 CST +08:00 | |
>> t.event.end_changed? | |
=> true | |
>> t.event.reset_end! | |
=> Thu, 16 Aug 2012 09:00:04 CST +08:00 | |
>> t.event.end_changed? | |
=> true | |
>> t.event.end_change | |
=> [Thu, 16 Aug 2012 09:00:04 CST +08:00, Thu, 16 Aug 2012 09:00:04 CST +08:00] | |
>> t.event.reset_end! | |
=> Thu, 16 Aug 2012 09:00:04 CST +08:00 | |
>> t.event.end_changed? | |
=> false | |
>> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment