diff options
author | Michael Koziarski <michael@koziarski.com> | 2006-04-06 02:45:19 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2006-04-06 02:45:19 +0000 |
commit | a86e594997a333e343936ca18c0f294058aeb083 (patch) | |
tree | 0667e4e0041fad3060048abd78f2de580874b7bc /activerecord/lib | |
parent | 58c435a3caebbe31c02e80c8f32840f0daa57d68 (diff) | |
download | rails-a86e594997a333e343936ca18c0f294058aeb083.tar.gz rails-a86e594997a333e343936ca18c0f294058aeb083.tar.bz2 rails-a86e594997a333e343936ca18c0f294058aeb083.zip |
Stop respond_to? from throwing when instances are created 'irregularly' i.e. yaml loads. [zenspider] Closes #4587
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4172 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib')
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/base.rb b/activerecord/lib/active_record/base.rb index 680d8db357..ecad32ebe2 100755 --- a/activerecord/lib/active_record/base.rb +++ b/activerecord/lib/active_record/base.rb @@ -1587,7 +1587,9 @@ module ActiveRecord #:nodoc: # A Person object with a name attribute can ask person.respond_to?("name"), person.respond_to?("name="), and # person.respond_to?("name?") which will all return true. def respond_to?(method, include_priv = false) - if attr_name = self.class.column_methods_hash[method.to_sym] + if @attributes.nil? + return super + elsif attr_name = self.class.column_methods_hash[method.to_sym] return true if @attributes.include?(attr_name) || attr_name == self.class.primary_key return false if self.class.read_methods.include?(attr_name) elsif @attributes.include?(method_name = method.to_s) |