Hi to all, i''m trying to pass the id of my record within the multipart form. I''ve tried to pass it like this but it gives a compile error.... <%= form_tag( { :action => ''create'', :id => @nominee }, :multipart => true ) do -%> <%= render :partial => ''form'' %> <%= submit_tag ''Edit'' %> <% end %> <%= link_to ''Show'', :action => ''show'', :id => @nominee %> | <%= link_to ''Back'', :action => ''list'' %> Can anybody help me??? Thanks i advance Andrea -- 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 -~----------~----~----~----~------~----~------~--~---
You typically won''t pass an id to a create action. I''m doing this with an update action using the same syntax that you have, and it works fine. If it matters, I don''t have an equal sign next to my form_tag (i.e., <% form_tag..., not <%= form_tag...). Do you want to set the id of the record that you''re creating (not recommended), or are you trying to pass a value to the record like nominee_id = 12? If you''re still having problems, please paste the error. -Kyle On Apr 1, 4:06 am, Andrea Campagna <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> Hi to all, > > i''m trying to pass the id of my record within the multipart form. > I''ve tried to pass it like this but it gives a compile error.... > > <%= form_tag( { :action => ''create'', :id => @nominee }, :multipart => > true ) do -%> > <%= render :partial => ''form'' %> > <%= submit_tag ''Edit'' %> > <% end %> > > <%= link_to ''Show'', :action => ''show'', :id => @nominee %> | > <%= link_to ''Back'', :action => ''list'' %> > > Can anybody help me??? > > Thanks i advance > > Andrea > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Kyle, sorry :) i want to pass it to the update function not the create, but i still have this error: compile error script/../config/../app/views/nominees/edit.rhtml:4: syntax error, unexpected '')'' _erbout.concat(( form_tag( { :action => ''update'', :id => @nominee }, :multipart => true ) do ).to_s) Code <%= form_tag( { :action => ''update'', :id => @nominee }, :multipart => true ) do -%> <%= render :partial => ''form'' %> <%= submit_tag ''Edit'' %> <% end %> thanks for your help!!> works fine. If it matters, I don''t have an equal sign next to my > form_tag (i.e., <% form_tag..., not <%= form_tag...). > > Do you want to set the id of the record that you''re creating (not > recommended), or are you trying to pass a value to the record like > nominee_id = 12? > > If you''re still having problems, please paste the error. > > -Kyle > > On Apr 1, 4:06 am, Andrea Campagna <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org>-- 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 -~----------~----~----~----~------~----~------~--~---
You''ll need <%= form_tag( { :action => ''update'', :id => @nominee }, {:multipart => true} ) do -%> While Ruby will attempt to do "THE RIGHT THING", you''ll find that if you specify the hash curly-braces on the first hash, you''ll also need to specify them on the second hash. Julian. Learn Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME) NEW VIDEO (#2) OUT NOW! http://sensei.zenunit.com/ On 03/04/2008, at 6:23 PM, Andrea Campagna wrote:> > Hi Kyle, > > sorry :) i want to pass it to the update function not the create, > but i > still have this error: > > compile error > script/../config/../app/views/nominees/edit.rhtml:4: syntax error, > unexpected '')'' > _erbout.concat(( form_tag( { :action => ''update'', :id => @nominee }, > :multipart => true ) do ).to_s) > > Code > > <%= form_tag( { :action => ''update'', :id => @nominee }, :multipart => > true ) do -%> > <%= render :partial => ''form'' %> > <%= submit_tag ''Edit'' %> > <% end %> > > thanks for your help!! > >> works fine. If it matters, I don''t have an equal sign next to my >> form_tag (i.e., <% form_tag..., not <%= form_tag...). >> >> Do you want to set the id of the record that you''re creating (not >> recommended), or are you trying to pass a value to the record like >> nominee_id = 12? >> >> If you''re still having problems, please paste the error. >> >> -Kyle >> >> On Apr 1, 4:06 am, Andrea Campagna <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> > > -- > 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 -~----------~----~----~----~------~----~------~--~---
> While Ruby will attempt to do "THE RIGHT THING", you''ll find that if > you specify the hash curly-braces on the first hash, you''ll also need > to specify them on the second hash.Hi Julian, i still have an error, the code is: <h1>Editing nominee</h1> <%= form_tag( { :action => ''update'', :id => @nominee }, {:multipart => true} do) -%> <%= render :partial => ''form'' %> <%= submit_tag ''Edit'' %> <% end %> and the compile error: compile error script/../config/../app/views/nominees/edit.rhtml:4: syntax error, unexpected kDO, expecting '')'' _erbout.concat(( form_tag( { :action => ''update'', :id => @nominee }, {:multipart => true} do) ).to_s) ^ script/../config/../app/views/nominees/edit.rhtml:5: syntax error, unexpected tIDENTIFIER, expecting '')'' _erbout.concat " "; _erbout.concat(( render :partial => ''form'' ).to_s); _erbout.concat "\n" ^ script/../config/../app/views/nominees/edit.rhtml:12: syntax error, unexpected kEND, expecting $end what could it be? -- 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 -~----------~----~----~----~------~----~------~--~---
do has to come after the close parenthesis... do reprsents the start of a block, and comes after the other arguments, which go inside the parenthesis. <%= form_tag( { :action => ''update'', :id => @nominee }, {:multipart => true}) do -%> <%= render :partial => ''form'' %> <%= submit_tag ''Edit'' %> <% end %> On 03/04/2008, at 6:50 PM, Andrea Campagna wrote:> >> While Ruby will attempt to do "THE RIGHT THING", you''ll find that if >> you specify the hash curly-braces on the first hash, you''ll also need >> to specify them on the second hash. > > Hi Julian, > > i still have an error, the code is: > > <h1>Editing nominee</h1> > > <%= form_tag( { :action => ''update'', :id => @nominee }, {:multipart => > true} do) -%> > <%= render :partial => ''form'' %> > <%= submit_tag ''Edit'' %> > <% end %> > > and the compile error: > > compile error > script/../config/../app/views/nominees/edit.rhtml:4: syntax error, > unexpected kDO, expecting '')'' > _erbout.concat(( form_tag( { :action => ''update'', :id => @nominee }, > {:multipart => true} do) ).to_s) > ^ > script/../config/../app/views/nominees/edit.rhtml:5: syntax error, > unexpected tIDENTIFIER, expecting '')'' > _erbout.concat " "; _erbout.concat(( render :partial => > ''form'' ).to_s); > _erbout.concat "\n" > ^ > script/../config/../app/views/nominees/edit.rhtml:12: syntax error, > unexpected kEND, expecting $end > > what could it be? > -- > 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 -~----------~----~----~----~------~----~------~--~---
Julian :) it doesn''t work even like this.... <%= form_tag( { :action => ''update'', :id => @nominee }, {:multipart => true}) do -%> <%= render :partial => ''form'' %> <%= submit_tag ''Edit'' %> <% end %> the compile error: compile error script/../config/../app/views/nominees/edit.rhtml:4: syntax error, unexpected '')'' _erbout.concat(( form_tag( { :action => ''update'', :id => @nominee }, {:multipart => true}) do ).to_s) ^ script/../config/../app/views/nominees/edit.rhtml:14: syntax error, unexpected kEND, expecting '')'' ?? Really thanks for your help! -- 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 -~----------~----~----~----~------~----~------~--~---
You shouldn''t use <%= %> when you''re using the block form. Julian. Learn Ruby on Rails! CHECK OUT THE FREE VIDS (LIMITED TIME) NEW VIDEO (#2) OUT NOW! http://sensei.zenunit.com/ On 03/04/2008, at 7:03 PM, Andrea Campagna wrote:> > > Julian :) it doesn''t work even like this.... > > <%= form_tag( { :action => ''update'', :id => @nominee }, {:multipart => > true}) do -%> > <%= render :partial => ''form'' %> > <%= submit_tag ''Edit'' %> > <% end %> > > the compile error: > > compile error > script/../config/../app/views/nominees/edit.rhtml:4: syntax error, > unexpected '')'' > _erbout.concat(( form_tag( { :action => ''update'', :id => @nominee }, > {:multipart => true}) do ).to_s) > ^ > script/../config/../app/views/nominees/edit.rhtml:14: syntax error, > unexpected kEND, expecting '')'' > > ?? > > Really thanks for your help! > -- > 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 -~----------~----~----~----~------~----~------~--~---
IT works!!!!!! Really thanks!!! -- 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 -~----------~----~----~----~------~----~------~--~---