aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/association_proxy.rb
diff options
context:
space:
mode:
authorJon Leighton <j@jonathanleighton.com>2011-01-06 19:32:05 +0000
committerAaron Patterson <aaron.patterson@gmail.com>2011-01-07 15:03:15 -0800
commit45d0d18baef2de739dae89bb7bc79826392bbde5 (patch)
treeb2fe8eb8c38494b29b68b988938694475d632b38 /activerecord/lib/active_record/associations/association_proxy.rb
parent770e6893b9f2aaaebe3de10576931dc7194451bc (diff)
downloadrails-45d0d18baef2de739dae89bb7bc79826392bbde5.tar.gz
rails-45d0d18baef2de739dae89bb7bc79826392bbde5.tar.bz2
rails-45d0d18baef2de739dae89bb7bc79826392bbde5.zip
Not really worth having the HasAssociation module for just a single method
Diffstat (limited to 'activerecord/lib/active_record/associations/association_proxy.rb')
-rw-r--r--activerecord/lib/active_record/associations/association_proxy.rb11
1 files changed, 9 insertions, 2 deletions
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)