From dbf9ec071497cd3935c8e5cd59df57f3fd9bbb17 Mon Sep 17 00:00:00 2001 From: Wojtek Kruszewski Date: Fri, 21 Feb 2014 14:47:39 +0100 Subject: Prevent foreign_key_for? from type casting all attributes --- activerecord/lib/active_record/associations/association.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'activerecord/lib') diff --git a/activerecord/lib/active_record/associations/association.rb b/activerecord/lib/active_record/associations/association.rb index 4e46256862..9ad2d2fb12 100644 --- a/activerecord/lib/active_record/associations/association.rb +++ b/activerecord/lib/active_record/associations/association.rb @@ -232,7 +232,7 @@ module ActiveRecord # Returns true if record contains the foreign_key def foreign_key_for?(record) - record.attributes.has_key? reflection.foreign_key + record.has_attribute?(reflection.foreign_key) end # This should be implemented to return the values of the relevant key(s) on the owner, -- cgit v1.2.3