Jump to content

The ultimate community for Ruby on Rails developers.


Wrong number of arguments - but is it 0 for 1, or 1 for 0?!?!?

  • Please log in to reply
1 reply to this topic

#1 RensterUK



  • Members
  • 7 posts

Posted 18 March 2014 - 01:50 PM



I have the following function (just experimenting currently, as you'll see) - in my controller's helper.rb file:


  def dowop(mymessage)
    puts mymessage
    alert mymessage
And I have the following in my view file:
<button id='SyncButton' onclick="<%= dowop ('boo') %>">Synchronise now!</button>
When I navigate to this view, it blows up, with a "wrong number of arguments (1 for 0)" error. I find this odd, since the definition of the function is expecting 1 param. However, it gets stranger. If I change the code in the view to 
<button id='SyncButton' onclick="<%= dowop %>">Synchronise now!</button>
It produces:
wrong number of arguments (0 for 1)

#2 RensterUK



  • Members
  • 7 posts

Posted 21 March 2014 - 08:58 AM   Best Answer

Solved - shouldn't have been trying to do this in the first place....


See https://railsforum.c...-to-controller/

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users