diff options
author | Jon Leighton <j@jonathanleighton.com> | 2011-09-10 21:10:01 +0100 |
---|---|---|
committer | Jon Leighton <j@jonathanleighton.com> | 2011-09-13 00:01:58 +0100 |
commit | 50d395f96ea05da1e02459688e94bff5872c307b (patch) | |
tree | c3856d526d35477131bb0bde1285a80fbb07fc4e /activerecord/test/cases/serialization_test.rb | |
parent | 8667d3aeb64dd8dba463ace364534326411bb46c (diff) | |
download | rails-50d395f96ea05da1e02459688e94bff5872c307b.tar.gz rails-50d395f96ea05da1e02459688e94bff5872c307b.tar.bz2 rails-50d395f96ea05da1e02459688e94bff5872c307b.zip |
Raise error when using write_attribute with a non-existent attribute.
Previously we would just silently write the attribute. This can lead to
subtle bugs (for example, see the change in AutosaveAssociation where a
through association would wrongly gain an attribute.
Also, ensuring that we never gain any new attributes after
initialization will allow me to reduce our dependence on method_missing.
Diffstat (limited to 'activerecord/test/cases/serialization_test.rb')
-rw-r--r-- | activerecord/test/cases/serialization_test.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/activerecord/test/cases/serialization_test.rb b/activerecord/test/cases/serialization_test.rb index 382d659289..61b04b3e37 100644 --- a/activerecord/test/cases/serialization_test.rb +++ b/activerecord/test/cases/serialization_test.rb @@ -7,12 +7,13 @@ class SerializationTest < ActiveRecord::TestCase def setup @contact_attributes = { - :name => 'aaron stack', - :age => 25, - :avatar => 'binarydata', - :created_at => Time.utc(2006, 8, 1), - :awesome => false, - :preferences => { :gem => '<strong>ruby</strong>' } + :name => 'aaron stack', + :age => 25, + :avatar => 'binarydata', + :created_at => Time.utc(2006, 8, 1), + :awesome => false, + :preferences => { :gem => '<strong>ruby</strong>' }, + :alternative_id => nil } end |