aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/dirty_test.rb
diff options
context:
space:
mode:
authorBen Symonds <ben@texperts.com>2008-12-08 14:11:55 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2008-12-08 15:42:13 -0800
commit091e6f791aa3324b2c7f8c8c4cd2fce12b689cc8 (patch)
tree381449412223c67200b9b273a2028f329c339769 /activerecord/test/cases/dirty_test.rb
parentebec9d43e262d28d742ff10acd828bad6cbb28ed (diff)
downloadrails-091e6f791aa3324b2c7f8c8c4cd2fce12b689cc8.tar.gz
rails-091e6f791aa3324b2c7f8c8c4cd2fce12b689cc8.tar.bz2
rails-091e6f791aa3324b2c7f8c8c4cd2fce12b689cc8.zip
Change field_changed? method to handle the case where a nullable integer column is changed from 0 to '0'
[#1530 state:committed] Signed-off-by: Jeremy Kemper <jeremy@bitsweat.net>
Diffstat (limited to 'activerecord/test/cases/dirty_test.rb')
-rw-r--r--activerecord/test/cases/dirty_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/dirty_test.rb b/activerecord/test/cases/dirty_test.rb
index 39d38c4e1e..10cdbdc622 100644
--- a/activerecord/test/cases/dirty_test.rb
+++ b/activerecord/test/cases/dirty_test.rb
@@ -68,6 +68,18 @@ class DirtyTest < ActiveRecord::TestCase
end
end
+ def test_nullable_integer_zero_to_string_zero_not_marked_as_changed
+ pirate = Pirate.new
+ pirate.parrot_id = 0
+ pirate.catchphrase = 'arrr'
+ assert pirate.save!
+
+ assert !pirate.changed?
+
+ pirate.parrot_id = '0'
+ assert !pirate.changed?
+ end
+
def test_zero_to_blank_marked_as_changed
pirate = Pirate.new
pirate.catchphrase = "Yarrrr, me hearties"