On Feb 28, 3:27 pm, Michael Baldock <[email protected]> wrote:
> Thanks for your help!
>
> >  =band_form.label "Select from saved Bands"
> >  =collection_select(band, :saved_band_name, @bands, :band_name,
> > :band_name, {:selected => @selected_band})
>
> That first argument to collection_select should be the name of the
> attribute, ie a symbol or string rather than an actual instance of
> band. The easy way would be to use the form builder, ie
> band_form.collection_form :saved_band_name, ... just like you're doing
> with other form inputs.
>
> ---------------
>
> I really didn't know I could use collection select in this way, thanks
> for the tip, not quite sure how it's working, but
>
> band_form.collection_select :saved_band_name, @bands, :band_name,
> :band_name, {:selected => @selected_band}
>

It's exactly the same as band_form.text_field. The form builder object
(ie band_form) encapsulates the object being edited & info about the
appropriate prefix for the input names.

Fred

> seems to be passing the selected band name through exactly as it should
> be :-))
>
> --
> 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 [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.

Reply via email to