This project is archived and is in readonly mode.
reverted changes should not be marked as changed
-
Tom Lea
- Tag set to activerecord, patch
+1 easy pitfall fixed
Patch to do this attached, changed format slightly.
-
seanliugm (at gmail)
- Title changed from attribute_changed? is true even though the value of attribute is changed to original value to reverted changes should not be marked as changed
-
Pratik
- Assigned user set to Jeremy Kemper
-
Ryan Bigg
+1 very useful imo
-
Damian Janowski
Can somebody paste a real world example?
Or is this to make your irb sessions "faster"?
-
Tom Lea
Example: Unpaid users can only store a maximum of 300 points, others can store more.
MAX_UNPAID_POINTS=300 user = User.find(session[:user_id]) user.points += 10 * user.years_has_been_a_member user.points = [user.points, MAX_UNPAID_POINTS].min unless user.paid? update_profile_icon if user.points_changed?Some people may prefer to do the same thing in different styles, assigning from the result of an if or similar, but this is a perfectly valid approach too.
-
Repository
- State changed from new to resolved
(from [a3a3067adbd578ad9d145f5a148816ec0460a987]) Dirty: treat two changes resulting in the original value as being unchanged.
[#798 reverted changes should not be marked as changed state:resolved]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net http://github.com/rails/rails/co...
-
Repository
(from [ad562c58eabfb8b44cb8ac9e87b87a7f998325fd]) Dirty: treat two changes resulting in the original value as being unchanged.
[#798 reverted changes should not be marked as changed state:resolved]
Signed-off-by: Jeremy Kemper jeremy@bitsweat.net http://github.com/rails/rails/co...
