aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/models
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-09-10 21:10:01 +0100
committerJon Leighton <j@jonathanleighton.com>2011-09-13 00:01:58 +0100
commit50d395f96ea05da1e02459688e94bff5872c307b (patch)
treec3856d526d35477131bb0bde1285a80fbb07fc4e /activerecord/test/models
parent8667d3aeb64dd8dba463ace364534326411bb46c (diff)
downloadrails-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/models')
-rw-r--r--activerecord/test/models/contact.rb13
1 files changed, 7 insertions, 6 deletions
diff --git a/activerecord/test/models/contact.rb b/activerecord/test/models/contact.rb
index e081eee661..3d15c7fbed 100644
--- a/activerecord/test/models/contact.rb
+++ b/activerecord/test/models/contact.rb
@@ -11,12 +11,13 @@ class Contact < ActiveRecord::Base
connection.merge_column('contacts', name, sql_type, options)
end
- column :name, :string
- column :age, :integer
- column :avatar, :binary
- column :created_at, :datetime
- column :awesome, :boolean
- column :preferences, :string
+ column :name, :string
+ column :age, :integer
+ column :avatar, :binary
+ column :created_at, :datetime
+ column :awesome, :boolean
+ column :preferences, :string
+ column :alternative_id, :integer
serialize :preferences