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: <tbody width="197"> 12: <tr> 13: <td style="width: 384px;"><label for>PRODUCT NAME</label></td> 14: <td style="width: 209px;"><%= form.text_field :product_name %></td> 15: </tr> 16: <tr> 17: <td style="width: 384px;"><label>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'' %> <div id="content" > <table style="height: 171px; width: 589px;"> <tbody width="197"> <tr> <td style="width: 384px;"></td> <td style="width: 209px;"> <div id="button"> <p><%= link_to_function ''Next'', "$(''product'').submit()" -%></p> <%= button_to ''update'', :controller => "create_setup_profile", :action => "update_prod_desc" %> </div> </td> </tr> </tbody> </table> </div> <% 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'' %> <div id="content" > <table style="height: 171px; width: 589px;"> <tbody width="197"> <tr> <td style="width: 384px;"></td> <td style="width: 209px;"> <div id="button"> <p><%= link_to_function ''Next'', "$(''update_product'').submit()" -%></p> </div> </td> </tr> </tbody> </table> </div> <% end %> <% end %> Thanks user splash -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
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> > 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: <tbody width="197"> > 12: <tr> > 13: <td style="width: 384px;"><label for>PRODUCT > NAME</label></td> > 14: <td style="width: 209px;"><%= > form.text_field :product_name > %></td> > 15: </tr> > 16: <tr> > 17: <td style="width: 384px;"><label>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'' %> > > > <div id="content" > > <table style="height: 171px; width: 589px;"> > <tbody width="197"> > <tr> > <td style="width: 384px;"></td> > <td style="width: 209px;"> > <div id="button"> > <p><%= link_to_function ''Next'', "$(''product'').submit()" -%></p> > > <%= button_to ''update'', :controller => "create_setup_profile", > :action => "update_prod_desc" %> > </div> > </td> > </tr> > </tbody> > </table> > </div> > <% 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'' %> > > > > <div id="content" > > <table style="height: 171px; width: 589px;"> > <tbody width="197"> > <tr> > <td style="width: 384px;"></td> > <td style="width: 209px;"> > <div id="button"> > > <p><%= link_to_function ''Next'', "$(''update_product'').submit()" > -%></p> > > </div> > </td> > </tr> > </tbody> > </table> > </div> > <% end %> > <% end %> > > > > Thanks > user splash > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Frederick Cheung 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. > > FredHi, I don''t quite understand the previous posting. Can anyone please elaborate. Thanks user splash -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 13 Jan 2008, at 13:28, fries 88 wrote:> > Frederick Cheung 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. >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> Thanks > user splash > -- > Posted via http://www.ruby-forum.com/. > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
stephen.celis-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
2008-Jan-13 16:10 UTC
Re: wrong number of arguments (0 for 1)
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 Cheung <frederick.che...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On 13 Jan 2008, at 13:28, fries 88 wrote: > > > > > > > Frederick Cheung 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. > > 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 > > > Thanks > > user splash > > -- > > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---