rails.impaired wrote:> I have the following piece of code in an app:
>
> @states = LookupValue.find(:all,
> :conditions => [''record_type =
?'',
> ''STATE''],
> :order => "char_value_1").map
{|u|
> [u.char_value_1, u.id] }
>
>
> This builds a list of codes and descriptions from a common values
> table. The values are used in a "select" on a page. The page
works
> fine, however, we would like to have an empty <option> inserted at
the
> beginning of the list to force the user to actually select an item
> from the list. Any suggestions how I can insert an empty/blank code/
> description to @states ??
>
> Thanks,
>
> rails.impaired
select("something", "something_id", @states, {
:include_blank => true })
read more here
http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html#M000506
--
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
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---