Although somewhat new, I continue to struggle with passing the right parameters to the Rails methods despite making direct reference to the documentation. For example, I want to create a form: form_tag :action => ''deliver'', :id => @event.id, :class => ''entry'' The class doesn''t show up. I''ve tried various combinations of hash braces. Also, what if I want to pass in an id for the form tag itself (e.g. #myentryform). This is a little frustrating. Has anyone else experienced this? What got you past this hurdle? Mario -- 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 5/22/07, Mario T. Lanza <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Although somewhat new, I continue to struggle with passing the right > parameters to the Rails methods despite making direct reference to the > documentation. For example, I want to create a form: > > form_tag :action => ''deliver'', :id => @event.id, :class => ''entry'' > > The class doesn''t show up. I''ve tried various combinations of hash > braces. Also, what if I want to pass in an id for the form tag itself > (e.g. #myentryform). > > This is a little frustrating. Has anyone else experienced this? What > got you past this hurdle?You have to establish when your first hash of parameters ends, otherwise form_tag will assume your :action, :id, and :class options are a single hash, when :class really needs to go in a separate hash. This might help explain a bit more: http://destiney.com/blog/rails-form-tag -- Greg Donald http://destiney.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 -~----------~----~----~----~------~----~------~--~---
Mario, Consider this: <%=start_form_tag({ :action=> ''quick_create'', :upload_id => @upid }, { :id => ''quick_campaign_form'', :multipart => true})%> You would put :class in the 2nd hash (eg. after :multipart). Otherwise, :class goes into the url_for method and I think is used as a param in the form post/get. On 5/22/07, Greg Donald <gdonald-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > > On 5/22/07, Mario T. Lanza <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote: > > > > Although somewhat new, I continue to struggle with passing the right > > parameters to the Rails methods despite making direct reference to the > > documentation. For example, I want to create a form: > > > > form_tag :action => ''deliver'', :id => @event.id, :class => ''entry'' > > > > The class doesn''t show up. I''ve tried various combinations of hash > > braces. Also, what if I want to pass in an id for the form tag itself > > (e.g. #myentryform). > > > > This is a little frustrating. Has anyone else experienced this? What > > got you past this hurdle? > > > You have to establish when your first hash of parameters ends, > otherwise form_tag will assume your :action, :id, and :class options > are a single hash, when :class really needs to go in a separate hash. > > This might help explain a bit more: > > http://destiney.com/blog/rails-form-tag > > > -- > Greg Donald > http://destiney.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 -~----------~----~----~----~------~----~------~--~---
Thanks, guys. After a few attempts I eventually did get it working, it''s just that often even with the help of the online RDoc it''s not clear. I''m sure I''ll get better. :) Mario -- 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 -~----------~----~----~----~------~----~------~--~---
Hi, I had the same problem for a long time. I would study the helper methods, but just couldnt get my head around it all. It seemed so vague. But the penny has just about dropped. I think understanding the Agile Rails chapters on form and field tags has helped. But just getting used to dealing with database results as models and feeling comfortable with the terminology took time. Now it starts to seem obvious. I guess the problem is that some of the Rails ''Automagic'' can initially tend to be ''Automysteryerious'' . tonypm On May 22, 10:29 pm, "Mario T. Lanza" <rails-mailing-l...@andreas- s.net> wrote:> Thanks, guys. After a few attempts I eventually did get it working, > it''s just that often even with the help of the online RDoc it''s not > clear. I''m sure I''ll get better. :) > Mario > > -- > 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 -~----------~----~----~----~------~----~------~--~---