Hello I just started messing around with RoR yesterday. I have a simple little data entry app I''m learning on currently. I just set it up with the scaffold command and then used rake to make the db for me. I have the fields all set up as "string" so they all by default from the scaffold use this same text boxes in the new.html.erb file Code: <% form_for(@beer) do |f| %> <p> <b>Name</b><br /> <%= f.text_field :name %> </p> My question is what is the do |f| actually doing. What is |f| referring to? Also how can I use a grouping of radio buttons to submit information as well as a select box with set options? (I want to have a "yes", "no", and "maybe") radio group for one of my fields and I want a select box with the US States in it. I have looked up the form stuff and all i could get it to do was display a radio button that did nothing when submitted. - I think this is probably my lack of understanding of ''f.'' I know it has to be a simple little thing and I look like a real noob for asking - but hey, I am a noob! I''m really excited about learning more RoR as I go on - its really fun so far. Thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---
On Jun 2, 8:09 am, "Truong Thanh Hai" <truongtuongq...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > My question is what is the do |f| actually doing. What is |f| referring to? > Also how can I use a grouping of radio buttons to submit information as well > as a select box with set options? (I want to have a "yes", "no", and > "maybe") radio group for one of my fields and I want a select box with the > US States in it. > > I have looked up the form stuff and all i could get it to do was display a > radio button that did nothing when submitted. - I think this is probably my > lack of understanding of ''f.'' >f is a form builder (the docs for form_for should say something about that). In a nutshell it is an object that knows the the object you''re manipulating is beer. You can create your own subclasses of Formbuilder that display things in particular ways. Fred> I know it has to be a simple little thing and I look like a real noob for > asking - but hey, I am a noob! I''m really excited about learning more RoR as > I go on - its really fun so far. > > Thanks!--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Hi Truong, This question is appropriate for rubyonrails-talk not rubyonrails-core. Core is for discussing development of the Rails framework itself. Cheers, Alan On Mon, Jun 2, 2008 at 5:09 PM, Truong Thanh Hai <truongtuongquan@gmail.com> wrote:> Hello I just started messing around with RoR yesterday. I have a simple > little data entry app I''m learning on currently. I just set it up with the > scaffold command and then used rake to make the db for me. > > I have the fields all set up as "string" so they all by default from the > scaffold use this same text boxes in the new.html.erb file > Code: > > <% form_for(@beer) do |f| %> > <p> > <b>Name</b><br /> > > <%= f.text_field :name %> > </p> > > My question is what is the do |f| actually doing. What is |f| referring to? > Also how can I use a grouping of radio buttons to submit information as well > as a select box with set options? (I want to have a "yes", "no", and > "maybe") radio group for one of my fields and I want a select box with the > US States in it. > > I have looked up the form stuff and all i could get it to do was display a > radio button that did nothing when submitted. - I think this is probably my > lack of understanding of ''f.'' > > I know it has to be a simple little thing and I look like a real noob for > asking - but hey, I am a noob! I''m really excited about learning more RoR as > I go on - its really fun so far. > > Thanks! > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com To unsubscribe from this group, send email to rubyonrails-core-unsubscribe@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en -~----------~----~----~----~------~----~------~--~---