aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2009-12-12 19:58:54 -0600
committerJoshua Peek <josh@joshpeek.com>2009-12-12 19:58:54 -0600
commit8a50f8a545ebde9cbae4187d1b1d5a59a29711f3 (patch)
tree9cb1cabd8fa056e6a41a93913dab66231a1fc442 /activerecord
parent39b708be96f470555bdc6d2c81f252f9f175f899 (diff)
downloadrails-8a50f8a545ebde9cbae4187d1b1d5a59a29711f3.tar.gz
rails-8a50f8a545ebde9cbae4187d1b1d5a59a29711f3.tar.bz2
rails-8a50f8a545ebde9cbae4187d1b1d5a59a29711f3.zip
Revert "Fix instance_eval calls to association proxies"
I think it may of broke the build. Lets see. This reverts commit 49e943c4f0ac3459bd53023167aaa08fc8e46733. Conflicts: activerecord/test/cases/associations/has_many_associations_test.rb
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/lib/active_record/associations/association_proxy.rb8
-rw-r--r--activerecord/test/cases/associations/has_many_associations_test.rb1
2 files changed, 6 insertions, 3 deletions
diff --git a/activerecord/lib/active_record/associations/association_proxy.rb b/activerecord/lib/active_record/associations/association_proxy.rb
index 6ad1e06300..7d8f4670fa 100644
--- a/activerecord/lib/active_record/associations/association_proxy.rb
+++ b/activerecord/lib/active_record/associations/association_proxy.rb
@@ -200,14 +200,18 @@ module ActiveRecord
private
# Forwards any missing method call to the \target.
- def method_missing(method, *args, &block)
+ def method_missing(method, *args)
if load_target
unless @target.respond_to?(method)
message = "undefined method `#{method.to_s}' for \"#{@target}\":#{@target.class.to_s}"
raise NoMethodError, message
end
- @target.send(method, *args, &block)
+ if block_given?
+ @target.send(method, *args) { |*block_args| yield(*block_args) }
+ else
+ @target.send(method, *args)
+ end
end
end
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb
index 05e7e380a8..551a1da0c6 100644
--- a/activerecord/test/cases/associations/has_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_associations_test.rb
@@ -1187,4 +1187,3 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
assert_equal 'Welcome to the weblog', Comment.all.map { |comment| comment.post }.sort_by(&:id).first.instance_eval{title}
end
end
-