diff options
-rw-r--r-- | activerecord/CHANGELOG | 2 | ||||
-rwxr-xr-x | activerecord/lib/active_record/base.rb | 4 |
2 files changed, 5 insertions, 1 deletions
diff --git a/activerecord/CHANGELOG b/activerecord/CHANGELOG index 9e3dd9d735..2831c377bb 100644 --- a/activerecord/CHANGELOG +++ b/activerecord/CHANGELOG @@ -1,5 +1,7 @@ *SVN* +* Allow AR::Base#respond_to? to behave when @attributes is nil [zenspider] + * Support eager includes when going through a polymorphic has_many association. [Rick] * Added support for eagerly including polymorphic has_one associations. (closes #4525) [Rick] 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) |