Wrong number of arguments (0 for 1) on notifiy method in Ruby on Rails
So I just got a cryptic error message: "Wrong number of arguments (0 for 1)" when using the check_box helper thus:
f.check_box :notify
Clearly I am providing the right number of arguments here. However, the problem lies with the notify method I have created. Observe...
script/console
Event.new.method :notify
=> #<Method: Event(ActiveRecord::Callbacks)#notify>
Turns out the notify method is already taken and is an ActiveRecord Call back. Doh!
About
Paul is a web developer for Kyanmedia web agency. He's lucky enough to write in Ruby on Rails full-time and uses this site to post snippets of code.
Contact
my name at gmail.com
More snippets
Take a look in the archive
Need a website?
Contact my employer. Make sure to check out our portfolio of work.
Hosting
I recommend hostingrails.com
3 comments made
I like to glance at the Reserved Words list on the wiki when picking names for models and attributes. This can help a lot in preventing tricky conflicts like this.
Good tip Ryan, definitely a link to have handy when trying to track down funky errors!
Thanks for the debugging hint, never faced it yet, but worth noticing. Kif.
Got something to say?