aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib
diff options
context:
space:
mode:
Diffstat (limited to 'activerecord/lib')
-rw-r--r--activerecord/lib/active_record/associations.rb1
-rw-r--r--activerecord/lib/active_record/associations/association_collection.rb2
-rw-r--r--activerecord/lib/active_record/associations/association_proxy.rb11
-rw-r--r--activerecord/lib/active_record/associations/has_association.rb14
-rw-r--r--activerecord/lib/active_record/associations/has_one_association.rb2
5 files changed, 9 insertions, 21 deletions
diff --git a/activerecord/lib/active_record/associations.rb b/activerecord/lib/active_record/associations.rb
index 78652ba0c5..3e7c9a370d 100644
--- a/activerecord/lib/active_record/associations.rb
+++ b/activerecord/lib/active_record/associations.rb
@@ -120,7 +120,6 @@ module ActiveRecord
# So there is no need to eager load them.
autoload :AssociationCollection, 'active_record/associations/association_collection'
autoload :AssociationProxy, 'active_record/associations/association_proxy'
- autoload :HasAssociation, 'active_record/associations/has_association'
autoload :ThroughAssociation, 'active_record/associations/through_association'
autoload :BelongsToAssociation, 'active_record/associations/belongs_to_association'
autoload :BelongsToPolymorphicAssociation, 'active_record/associations/belongs_to_polymorphic_association'
diff --git a/activerecord/lib/active_record/associations/association_collection.rb b/activerecord/lib/active_record/associations/association_collection.rb
index f33a9ce732..daec8493ac 100644
--- a/activerecord/lib/active_record/associations/association_collection.rb
+++ b/activerecord/lib/active_record/associations/association_collection.rb
@@ -18,8 +18,6 @@ module ActiveRecord
# If you need to work on all current children, new and existing records,
# +load_target+ and the +loaded+ flag are your friends.
class AssociationCollection < AssociationProxy #:nodoc:
- include HasAssociation
-
delegate :group, :order, :limit, :joins, :where, :preload, :eager_load, :includes, :from, :lock, :readonly, :having, :to => :scoped
def select(select = nil)
diff --git a/activerecord/lib/active_record/associations/association_proxy.rb b/activerecord/lib/active_record/associations/association_proxy.rb
index 405a0307c1..294e1cab50 100644
--- a/activerecord/lib/active_record/associations/association_proxy.rb
+++ b/activerecord/lib/active_record/associations/association_proxy.rb
@@ -9,11 +9,11 @@ module ActiveRecord
# AssociationProxy
# BelongsToAssociation
# BelongsToPolymorphicAssociation
- # AssociationCollection + HasAssociation
+ # AssociationCollection
# HasAndBelongsToManyAssociation
# HasManyAssociation
# HasManyThroughAssociation + ThroughAssociation
- # HasOneAssociation + HasAssociation
+ # HasOneAssociation
# HasOneThroughAssociation + ThroughAssociation
#
# Association proxies in Active Record are middlemen between the object that
@@ -252,6 +252,13 @@ module ActiveRecord
table.create_and(conditions)
end
+ # Sets the owner attributes on the given record
+ def set_owner_attributes(record)
+ if @owner.persisted?
+ construct_owner_attributes.each { |key, value| record[key] = value }
+ end
+ end
+
private
# Forwards any missing method call to the \target.
def method_missing(method, *args)
diff --git a/activerecord/lib/active_record/associations/has_association.rb b/activerecord/lib/active_record/associations/has_association.rb
deleted file mode 100644
index 8b180c7301..0000000000
--- a/activerecord/lib/active_record/associations/has_association.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-module ActiveRecord
- module Associations
- # Included in all has_* associations (i.e. everything except belongs_to)
- module HasAssociation #:nodoc:
- protected
- # Sets the owner attributes on the given record
- def set_owner_attributes(record)
- if @owner.persisted?
- construct_owner_attributes.each { |key, value| record[key] = value }
- end
- end
- end
- end
-end
diff --git a/activerecord/lib/active_record/associations/has_one_association.rb b/activerecord/lib/active_record/associations/has_one_association.rb
index 5107be1eaf..bee5700bfc 100644
--- a/activerecord/lib/active_record/associations/has_one_association.rb
+++ b/activerecord/lib/active_record/associations/has_one_association.rb
@@ -2,8 +2,6 @@ module ActiveRecord
# = Active Record Belongs To Has One Association
module Associations
class HasOneAssociation < AssociationProxy #:nodoc:
- include HasAssociation
-
def create(attrs = {})
new_record do |reflection|
attrs = merge_with_conditions(attrs)