I have a method in application_helper.rb like this: def my_method(arg1, arg2 = {}) ... end when I call this method from an rhtml file like this: my_method @var I get this message: wrong number of arguments (1 for 0) When I call the method without arguments like this: my_method I get this message: wrong number of arguments (0 for 1) I am new to Ruby and Rails so I presume that I''m missing something really obvious, but huh? Why is it that when I call it with arguments, it doesn''t want any, but when I call it without them, it does? Is it the *type* of argument? But since the parameters are dynamically typed, that makes no sense to me. What am I missing? Chas. Munat Seattle
Aha! The wrong number of arguments (1 for 0) is actually coming from something inside the method. That explains it. Never mind. Chas. Charles F. Munat wrote:> I have a method in application_helper.rb like this: > > def my_method(arg1, arg2 = {}) > ... > end > > when I call this method from an rhtml file like this: > > my_method @var > > I get this message: > > wrong number of arguments (1 for 0) > > When I call the method without arguments like this: > > my_method > > I get this message: > > wrong number of arguments (0 for 1) > > > I am new to Ruby and Rails so I presume that I''m missing something > really obvious, but huh? Why is it that when I call it with arguments, > it doesn''t want any, but when I call it without them, it does? Is it the > *type* of argument? But since the parameters are dynamically typed, that > makes no sense to me. > > What am I missing? > > Chas. Munat > Seattle > _______________________________________________ > Rails mailing list > Rails@lists.rubyonrails.org > http://lists.rubyonrails.org/mailman/listinfo/rails