diff options
author | Emilio Tagua <miloops@gmail.com> | 2009-05-05 10:14:28 -0300 |
---|---|---|
committer | Emilio Tagua <miloops@gmail.com> | 2009-05-05 10:14:28 -0300 |
commit | a83a1ccebaaae5e05741ebd5d9db408c450df098 (patch) | |
tree | 79dc5924ce11481674180e1d216ec6551e634011 /activerecord/lib/active_record/associations/has_one_association.rb | |
parent | d19d4d2f20d87289eaeaa8df807d635ce72f3799 (diff) | |
parent | d4402c5554a0d3202fc22eb38c5c1a8c4b9afd93 (diff) | |
download | rails-a83a1ccebaaae5e05741ebd5d9db408c450df098.tar.gz rails-a83a1ccebaaae5e05741ebd5d9db408c450df098.tar.bz2 rails-a83a1ccebaaae5e05741ebd5d9db408c450df098.zip |
Merge commit 'rails/master'
Diffstat (limited to 'activerecord/lib/active_record/associations/has_one_association.rb')
-rw-r--r-- | activerecord/lib/active_record/associations/has_one_association.rb | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/activerecord/lib/active_record/associations/has_one_association.rb b/activerecord/lib/active_record/associations/has_one_association.rb index 1464227bb0..4908005d2e 100644 --- a/activerecord/lib/active_record/associations/has_one_association.rb +++ b/activerecord/lib/active_record/associations/has_one_association.rb @@ -74,13 +74,15 @@ module ActiveRecord private def find_target - @reflection.klass.find(:first, + the_target = @reflection.klass.find(:first, :conditions => @finder_sql, :select => @reflection.options[:select], :order => @reflection.options[:order], :include => @reflection.options[:include], :readonly => @reflection.options[:readonly] ) + set_inverse_instance(the_target, @owner) + the_target end def construct_sql @@ -117,8 +119,15 @@ module ActiveRecord self.target = record end + set_inverse_instance(record, @owner) + record end + + def we_can_set_the_inverse_on_this?(record) + inverse = @reflection.inverse_of + return !inverse.nil? + end end end end |