Permalink
Browse files

Ruby 1.9.2: use super rather than raise our own NoMethodError to work…

… around to_ary issues
  • Loading branch information...
1 parent 3fa8ca5 commit 61bb491cbe70fe112157f357c87da6de44b35db6 @jeremy jeremy committed Nov 13, 2009
Showing with 7 additions and 8 deletions.
  1. +7 −8 activerecord/lib/active_record/associations/association_proxy.rb
@@ -210,15 +210,14 @@ def with_scope(*args, &block)
# Forwards any missing method call to the \target.
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
-
- if block_given?
- @target.send(method, *args) { |*block_args| yield(*block_args) }
+ if @target.respond_to?(method)
+ if block_given?
+ @target.send(method, *args) { |*block_args| yield(*block_args) }
+ else
+ @target.send(method, *args)
+ end
else
- @target.send(method, *args)
+ super
end
end
end

0 comments on commit 61bb491

Please sign in to comment.