aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/lib/active_record/associations/has_many_through_association.rb
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-02-15 21:47:27 +0000
committerJeremy Kemper <jeremy@bitsweat.net>2008-02-15 21:47:27 +0000
commitc55120c8e6922146fa50bf1e4f4d87d4820e09dc (patch)
tree10b21c201d833a853a49b8615e364bbfaa028aa4 /activerecord/lib/active_record/associations/has_many_through_association.rb
parent6f0b0125d0f9044074fcb6f9b1528937a2bb4d2e (diff)
downloadrails-c55120c8e6922146fa50bf1e4f4d87d4820e09dc.tar.gz
rails-c55120c8e6922146fa50bf1e4f4d87d4820e09dc.tar.bz2
rails-c55120c8e6922146fa50bf1e4f4d87d4820e09dc.zip
Revert [8865], broke AP record identifier. Reopens #11109.
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8874 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'activerecord/lib/active_record/associations/has_many_through_association.rb')
-rw-r--r--activerecord/lib/active_record/associations/has_many_through_association.rb12
1 files changed, 5 insertions, 7 deletions
diff --git a/activerecord/lib/active_record/associations/has_many_through_association.rb b/activerecord/lib/active_record/associations/has_many_through_association.rb
index 81ec428d34..94842f424d 100644
--- a/activerecord/lib/active_record/associations/has_many_through_association.rb
+++ b/activerecord/lib/active_record/associations/has_many_through_association.rb
@@ -113,8 +113,8 @@ module ActiveRecord
end
# Calculate sum using SQL, not Enumerable
- def sum(*args)
- calculate(:sum, *args) { |*block_args| yield(*block_args) if block_given? }
+ def sum(*args, &block)
+ calculate(:sum, *args, &block)
end
def count(*args)
@@ -128,13 +128,11 @@ module ActiveRecord
end
protected
- def method_missing(method, *args)
+ def method_missing(method, *args, &block)
if @target.respond_to?(method) || (!@reflection.klass.respond_to?(method) && Class.respond_to?(method))
- super { |*block_args| yield(*block_args) if block_given? }
+ super
else
- @reflection.klass.send(:with_scope, construct_scope) do
- @reflection.klass.send(method, *args) { |*block_args| yield(*block_args) if block_given? }
- end
+ @reflection.klass.send(:with_scope, construct_scope) { @reflection.klass.send(method, *args, &block) }
end
end