From: Brian Candler Date: 2010-09-18T17:50:46+09:00 Subject: Re: method_missing Diego Viola wrote: > I tried this code: > > http://gist.github.com/585143 > > but why do i get a: asd.rb:6:in `method_missing': wrong number of > arguments (1 for 0) (ArgumentError) -- when i try to call > method_missing like that? > > if i use method_missing(*args) it works, does method_missing requires > that i use an argument? Run the code I first posted again, and look at the output carefully. method_missing is passed the name of the method which didn't exist as the first argument, followed by 0 or more values which were the arguments to the original call. So you must define it to receive at least one argument. A good template to use: def method_missing(method_name, *args, &block) ... end -- Posted via http://www.ruby-forum.com/.