Greetings all, I am making a drop down list using options_from_collection_for_select. However I need to wrap it in the HTML <select> tags. Looking at the Rails framework doc, it would seem that I could use select() to generate the options and the <select> tag. However I cannot seem to figure out how to call the classes to pull the info from the DB. Would seem that I have to combine it with another function. However when I combine it with options_from_collection_for_select the actual <option> tags will print out as text within the selection field. <option value="<option value="2">Something</option>"><option value="2">Something</option></option> This obviously is not what I want. But I cannot seem to figure out the correct class merger to get <option value="2">Something</option> from the database within a generated <select> tag and help?? Thanx Phillip -- 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 -~----------~----~----~----~------~----~------~--~---
Phillip Baker wrote:> > This obviously is not what I want. But I cannot seem to figure out the > correct class merger to get > <option value="2">Something</option> > from the database within a generated <select> tag and help?? >Something like select("post", "person_id", Person.find(:all).collect {|p| [ p.name, p.id ] }) (assuming your controller has an instance variable @post with a person_id attribute) ? Fred -- 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 -~----------~----~----~----~------~----~------~--~---