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?
The error i got is:
ArgumentError in Create_setup_profile#find_count
Showing app/views/create_setup_profile/_update_prod_desc.rhtml where
line #14 raised:
wrong number of arguments (0 for 1)
Extracted source (around line #14):
11:
12:
13: PRODUCT
NAME |
14: <%= form.text_field :product_name
%> |
15:
16:
17: SIZE
Trace of template inclusion:
/app/views/create_setup_profile/find_count.rhtml
RAILS_ROOT: ./script/…/config/…
In my controller:
def find_count
session[:count] ||= 0
session[:count] += 1
end
In the find_count.rhtml:
<% if session[:count] == 1 %>
<% form_for :e0_1_prod_desc, :url => { :action => :save_prod_desc },
:html => { :id => “product” } do |form| %>
<%= render :partial => ‘prod_desc’ %>
|
<%= link_to_function 'Next', "$('product').submit()" -%>
<%= button_to 'update', :controller => "create_setup_profile",
:action => "update_prod_desc" %>
</div>
</td>
</tr>
</tbody>
</table>
<% end %>
<% elsif session[:count] > 1 %>
<% form_for :e0_1_prod_desc, :url => { :action => :edit_prod_desc },
:html => { :id => “update_product” } do |form| %>
<%= render :partial => 'update_prod_desc' %>
|
<p><%= link_to_function 'Next', "$('update_product').submit()"
-%>
</div>
</td>
</tr>
</tbody>
</table>
<% end %>
<% end %>
Thanks
user splash
|
|
|
On 13 Jan 2008, at 12:46, fries 88 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
Frederick C. wrote:
On 13 Jan 2008, at 12:46, fries 88 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.
Thanks
user splash
On 13 Jan 2008, at 13:28, fries 88 wrote:
and when i enter the page the subsequent times i will be able to
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 %>
On Jan 13, 10:04 am, Frederick C. [email protected]