-
Notifications
You must be signed in to change notification settings - Fork 21.9k
Description
After upgrading from Rails 3.2.6 to 3.2.7, encountered a test failure when evaluating an integer attribute that contained a zero value as changed. Tested other non-integer values and the _changed? status was correct. The following is a quick test to reproduce the problem:
First obtain an integer attribute from the database table (using postgres in my case):
r=Review.find_by_issue(11)
r.issue
=> 11
r.changes
=> {}
r.issue = 11
=> 11
r.changed?
=> false
r.changes
=> {}
The above works as it did before in Rails 3.2.6. The next test using zero has a different behavior:
r=Review.find_by_issue(0)
r.issue
=> 0
r.changes
=> {}
r.issue = 0
=> 0
r.changed?
=> true
r.changes
=> {"issue"=>[0,0]}
It now treats a zero value to the same zero value as a change in Rails 3.2.7. I also tested this against Rails 3.2.8rc1 and encountered the same problem.