Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make NoMethodError message more descriptive when an undefined message…
… has been sent to an association [#1515 state:resolved]

Signed-off-by: Joshua Peek <josh@joshpeek.com>
  • Loading branch information
Mike Ferrier authored and josh committed Dec 4, 2008
1 parent b2ad302 commit 566a3dc
Showing 1 changed file with 4 additions and 1 deletion.
Expand Up @@ -207,7 +207,10 @@ def with_scope(*args, &block)
# Forwards any missing method call to the \target.
def method_missing(method, *args)
if load_target
raise NoMethodError unless @target.respond_to?(method)
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) }
Expand Down

0 comments on commit 566a3dc

Please sign in to comment.