Re: Radio button issues in a list

Frederick Cheung
2008-10-15T23:43:01Z

On Oct 16, 12:01 am, Teresa Mcmillin <rails-mailing-l...@andreas-
s.net> wrote:
> <%= radio_button("company",
"default_company", true) %>

that third parameter is what will appear in params[:company]
[:default_company] so typically you set it to something like
@company.id.

Overwriting @company like that won''t do you any favours, I would do

 <% for company in @companies %>

<%= company.name %>
<%= company.size %>
<%= radio_button("company",
"default_company", company.id) %>

<% end %>

Fred


>
>   <% end %>
>
>   <%= submit_tag "Change Default" %>
> <% end %>
>
> From this list, the user is allowed to change the default company and
> click on a button (implemented with a submit tag, which calls a method
> in the controller).  The radio buttons are the only editable field on
> this form.
>
> Question:  How do I get the necessary values back to the controller?
> Currently, I only get the selected radio button, but not the associated
> company data.
>
> TIA,
>
> TMac
> --
> 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
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com