Zach | 17 May 19:42

Re: Select and how to read the api


This is the last sentence in the link you posted:
"Specify :selected => value to use a different selection or :selected
=> nil to leave all options unselected."

On May 17, 7:43 am, Pål Bergström <rails-mailing-l...@...>
wrote:
> Pål Bergström wrote:
> > I'm trying to understand how to use the select, especially how to make
> > an option selected. I want to add the values manually, but be sure one
> > value is selected when finding an existing post in the db.
>
> > How are you supposed to understand how to do that from this?
>
> >http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelp...
>
> > This is what I've used until now:
>
> > <%= select 'user', 'age',
> > ['','10-20','20-30','30-40','40-50','50-60','60-70','70+']  %>
>
> Got it.
>
> <%= select 'user', 'age',
> ['','10-20','20-30','30-40','40-50','50-60','60-70','70+'], :selected =>
> @selected_value  %>
>
> Is that described in the api? I can't find it.
> --
> 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@...
To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe <at> googlegroups.com
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---


Gmane