wrong number of arguments (0 for 1)

Hi, I got this error i got after i click the link to go to the product
page where if it is the first time i enter this page, i will be able to
save and when i enter the page the subsequent times i will be able to edit the data i had just save. Anyone please help. What went wrong here?

You need to be passing the form builder through to the partial
(via :locals for example). Since you haven't, ruby assumes that form refers to the method form,
which does indeed take at least one argument.

Fred

Frederick Cheung wrote:

Frederick Cheung wrote:

Hi, I got this error i got after i click the link to go to the product page where if it is the first time i enter this page, i will be able to save and when i enter the page the subsequent times i will be able to
edit the data i had just save. Anyone please help. What went wrong here?

You need to be passing the form builder through to the partial (via :locals for example). Since you haven't, ruby assumes that form refers to the method form, which does indeed take at least one argument.

Fred

Hi, I don't quite understand the previous posting. Can anyone please elaborate.

You're trying to use your formbuilder 'form' in your partial, but
there is no local variable called form in that partial and so ruby
assumes you're calling the form function, which requires at least one
parameter (hence the error). You need to pass the form to the partial
using locals, ie render :partial => 'some_partial', :locals => {:form
=> foo} will make a local variable in that partial called form and whose value
is foo.

Fred

Or, name the partial '_form.html.erb' and render it as an object:

<%= render :partial => 'form', :object => form %>