On Apr 12, 8:59 pm, RichardOnRails
<[email protected]> wrote:
> PRiyanka and sameera: Thank you both very much!!!  I've been pulling
> my hair out for about a week with this thing.
>
> I didn't realize that the first argument of the select_tag function
> apparently identifies the target
> of the selected item in the format "table_name[column_name]".
>

you could have dodged that if you'd gone with f.select :vendor,
choices
The second parameter to f.select has the same requirements as what you
give to options_for_select

Fred
>
> On Apr 12, 2:11 am, Priyanka Pathak <[email protected]> wrote:
>
>
>
> > RichardOnRails wrote:
> > > In app\views\expenses\new.html.erb,  I (mistakenly) replaced the
> > > script/generated:
> > > <%= f.label :vendor %><br />
> > > <%= f.text_field :vendor %>
> > > with:
> > > <%= f.label :vendor %><br />
> > > <% @current_vendors = Vendor.find(:all, :order=>"nickname") %>
> > > <%= select_tag "list",  options_for_select(@current_vendors) %>
>
> > > This (if I haven't introduced any typos here) works fine, except that
> > > the user-selection doesn't really populate the database's vendors
> > > column in the expense record.
>
> > > How do I repair this situation?  I'd like to restore the the original
> > > text field and somehow populate it with the user-selected value from
> > > the select control.
>
> > Hi,
> >    try this <%= select_tag "expense_vendor",
> > options_for_select(@current_vendors) %>.
> > --
> > 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