On 10 May 2012 12:13, Michael Baldock <[email protected]> wrote: > Thanks for that, it works exactly as you said! cheers, now I have the > line > > <%= f.select(:formation_csv, @formations) %> > > and it magically knows which one to select. > > I'm still v curios as to why the "options_for_select(formations_array, > 2)" didn't do anything, is it because when I'm using this in conjunction > with the form_helper, ie f.select as opposed to select_tag, the > options_for_select method becomes redundant, or different? >
Yeah, it's redundant. Your code was also wrong :) The second paramater needs to be the value of the selected object, not the array index. So options_for_select(formations_array, "5-3-2") would probably have worked. It's a bad idea though in a resource-based form though. Glad you've got it sorted! My experience with Rails says if something feels like it's getting unnecessarily complex, you're probably doing it wrong! :) > > -- > 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 [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > > -- 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 [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

