aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/has_one_association.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib/active_record/associations/has_one_association.rb')
-rw-r--r--activerecord/lib/active_record/associations/has_one_association.rb10
1 files changed, 5 insertions, 5 deletions
diff --git a/activerecord/lib/active_record/associations/has_one_association.rb b/activerecord/lib/active_record/associations/has_one_association.rb
index b72b84343b..c2568d0c0c 100644
--- a/activerecord/lib/active_record/associations/has_one_association.rb
+++ b/activerecord/lib/active_record/associations/has_one_association.rb
@@ -1,6 +1,6 @@
module ActiveRecord
module Associations
- class HasOneAssociation < BelongsToAssociation #:nodoc:
+ class HasOneAssociation < AssociationProxy #:nodoc:
def initialize(owner, reflection)
super
construct_sql
@@ -77,7 +77,7 @@ module ActiveRecord
the_target = @reflection.klass.find(:first,
:conditions => @finder_sql,
:select => @reflection.options[:select],
- :order => @reflection.options[:order],
+ :order => @reflection.options[:order],
:include => @reflection.options[:include],
:readonly => @reflection.options[:readonly]
)
@@ -88,7 +88,7 @@ module ActiveRecord
def construct_sql
case
when @reflection.options[:as]
- @finder_sql =
+ @finder_sql =
"#{@reflection.quoted_table_name}.#{@reflection.options[:as]}_id = #{owner_quoted_id} AND " +
"#{@reflection.quoted_table_name}.#{@reflection.options[:as]}_type = #{@owner.class.quote_value(@owner.class.base_class.name.to_s)}"
else
@@ -96,7 +96,7 @@ module ActiveRecord
end
@finder_sql << " AND (#{conditions})" if conditions
end
-
+
def construct_scope
create_scoping = {}
set_belongs_to_association_for(create_scoping)
@@ -113,7 +113,7 @@ module ActiveRecord
end
if replace_existing
- replace(record, true)
+ replace(record, true)
else
record[@reflection.primary_key_name] = @owner.id unless @owner.new_record?
self.target = record