aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/belongs_to_association.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/associations/belongs_to_association.rb')
-rw-r--r--activerecord/lib/active_record/associations/belongs_to_association.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/activerecord/lib/active_record/associations/belongs_to_association.rb b/activerecord/lib/active_record/associations/belongs_to_association.rb
index 4558872a2b..2eb56e5cd3 100644
--- a/activerecord/lib/active_record/associations/belongs_to_association.rb
+++ b/activerecord/lib/active_record/associations/belongs_to_association.rb
@@ -49,12 +49,16 @@ module ActiveRecord
else
"find"
end
+
+ options = @reflection.options.dup
+ (options.keys - [:select, :include, :readonly]).each do |key|
+ options.delete key
+ end
+ options[:conditions] = conditions
+
the_target = @reflection.klass.send(find_method,
@owner[@reflection.primary_key_name],
- :select => @reflection.options[:select],
- :conditions => conditions,
- :include => @reflection.options[:include],
- :readonly => @reflection.options[:readonly]
+ options
) if @owner[@reflection.primary_key_name]
set_inverse_instance(the_target, @owner)
the_target