aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record
diff options
context:
space:
mode:
authorJonathan del Strother <jon.delStrother@audioboo.fm>2012-01-19 16:06:31 +0000
committerJonathan del Strother <jon.delStrother@audioboo.fm>2012-01-19 17:13:06 +0000
commitee2ae378cb08c4a671c08093ceab77efbd3a001d (patch)
tree82d5993027d5827c934e38f15c23a2f45a96bcb9 /activerecord/lib/active_record
parentb5134601adebd1dbebc18be35c5e5336011a023f (diff)
downloadrails-ee2ae378cb08c4a671c08093ceab77efbd3a001d.tar.gz
rails-ee2ae378cb08c4a671c08093ceab77efbd3a001d.tar.bz2
rails-ee2ae378cb08c4a671c08093ceab77efbd3a001d.zip
Don't instantiate two objects in collection proxy / find_or_instantiator_by
Diffstat (limited to 'activerecord/lib/active_record')
-rw-r--r--activerecord/lib/active_record/associations/collection_proxy.rb3
1 files changed, 1 insertions, 2 deletions
diff --git a/activerecord/lib/active_record/associations/collection_proxy.rb b/activerecord/lib/active_record/associations/collection_proxy.rb
index ba01df00e3..5eda0387c4 100644
--- a/activerecord/lib/active_record/associations/collection_proxy.rb
+++ b/activerecord/lib/active_record/associations/collection_proxy.rb
@@ -82,9 +82,8 @@ module ActiveRecord
proxy_association.send :add_to_target, r
yield(r) if block_given?
end
- end
- if target.respond_to?(method) || (!proxy_association.klass.respond_to?(method) && Class.respond_to?(method))
+ elsif target.respond_to?(method) || (!proxy_association.klass.respond_to?(method) && Class.respond_to?(method))
if load_target
if target.respond_to?(method)
target.send(method, *args, &block)