Re: Radio button issues in a list

Teresa Mcmillin
2008-10-16T00:31:01Z

Frederick Cheung wrote:
> 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

I have changed the third parm and I see what you mean, but here is my
confusion.  I thought the third parm was used for determining which
radio
button should be selected, when loading the companies from the database.
In my case, only one company has default set to true, so I put true in
the third parm.  It works nicely for displaying the data.

So now the question becomes how do I set that radio button values to
correspond to the database values?

Thanks for your help.

TMac
--
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