aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorMichael Koziarski <michael@koziarski.com>2010-12-02 15:36:05 +1300
committerAaron Patterson <aaron.patterson@gmail.com>2010-12-02 08:40:34 -0800
commit96eec090dfd50326146b2f690408fefec50c5111 (patch)
tree55bef0491b1bca2679bd6e3defe8174b637b4b99 /activerecord/lib/active_record
parent0afebd5b31bdc6edc1399c77153e65f5ea156fe1 (diff)
downloadrails-96eec090dfd50326146b2f690408fefec50c5111.tar.gz
rails-96eec090dfd50326146b2f690408fefec50c5111.tar.bz2
rails-96eec090dfd50326146b2f690408fefec50c5111.zip
Work around a strange piece of Syck behaviour where it checks Model#respond_to? before initializing the object.
Things like YAML.load(YAML.dump(@post)) won't work without this.
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/attribute_methods.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/attribute_methods.rb b/activerecord/lib/active_record/attribute_methods.rb
index 67f70c434e..4f4a0a5fee 100644
--- a/activerecord/lib/active_record/attribute_methods.rb
+++ b/activerecord/lib/active_record/attribute_methods.rb
@@ -54,7 +54,7 @@ module ActiveRecord
protected
def attribute_method?(attr_name)
- attr_name == 'id' || @attributes.include?(attr_name)
+ attr_name == 'id' || (defined?(@attributes) && @attributes.include?(attr_name))
end
end
end