diff options
author | Rich Cavanaugh <rich@withoutscope.com> | 2008-08-15 21:49:22 -0400 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-09-13 11:41:14 +0200 |
commit | 113de01eaf48f64d2adf9f34d699e51619af616f (patch) | |
tree | 8d24c2f6fb226604a609773d5a5a2e14897baf38 /activerecord/test/cases | |
parent | fcf31cb7521ba7de0aae972ac2ddfc80e3e7dfce (diff) | |
download | rails-113de01eaf48f64d2adf9f34d699e51619af616f.tar.gz rails-113de01eaf48f64d2adf9f34d699e51619af616f.tar.bz2 rails-113de01eaf48f64d2adf9f34d699e51619af616f.zip |
Allow for the dirty tracking to work with the aliased name of aliased attributes.
Signed-off-by: Michael Koziarski <michael@koziarski.com>
[#812 state:committed]
Diffstat (limited to 'activerecord/test/cases')
-rw-r--r-- | activerecord/test/cases/dirty_test.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/activerecord/test/cases/dirty_test.rb b/activerecord/test/cases/dirty_test.rb index 4fe1d79f4d..39d38c4e1e 100644 --- a/activerecord/test/cases/dirty_test.rb +++ b/activerecord/test/cases/dirty_test.rb @@ -45,6 +45,19 @@ class DirtyTest < ActiveRecord::TestCase assert_nil pirate.catchphrase_change end + def test_aliased_attribute_changes + # the actual attribute here is name, title is an + # alias setup via alias_attribute + parrot = Parrot.new + assert !parrot.title_changed? + assert_nil parrot.title_change + + parrot.name = 'Sam' + assert parrot.title_changed? + assert_nil parrot.title_was + assert_equal parrot.name_change, parrot.title_change + end + def test_nullable_integer_not_marked_as_changed_if_new_value_is_blank pirate = Pirate.new |