Forum: Ruby on Rails Select not providing default option

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
C728d93eb5205cf20cac0c2928b0ad62?d=identicon&s=25 Jeff Jones (rurounijones)
on 2006-03-23 14:36
Hello all.

I am running Rails 1.0 and am having trouble with the select box. In the
API it says.

"Create a select tag and a series of contained option tags for the
provided object and method. The option currently held by the object will
be selected, provided that the object is available. See
options_for_select for the required format of the choices parameter."

and then goes on to provide a parameter

I find myself in that exact scenario (replace @post.person_id with
@area.uniface_version_id) but the value is not appearing as the default
when the page is loaded.

@area.uniface_version_id is definately populated (checked in the
breakpointer) but it isn't being set as standard for some reason
(Nothing is).

The code is

Controller:

  def edit
    @area = Area.find(params[:id])
    render :partial => 'edit'
  end

View:

<%= select('area', 'uniface_version_id', UnifaceVersion.find_all.collect
{|uv| [ uv.name, uv.id ] }, { :include_blank => true }) %>

(This was copied verbatim from the scaffold _form partial)

If anyone has any pointers that would be great.

Thanks

Jeff
C728d93eb5205cf20cac0c2928b0ad62?d=identicon&s=25 Jeff Jones (rurounijones)
on 2006-03-23 14:41
> and then goes on to provide a parameter

Sorry, that should read

and then goes on to provide an example


(Stupid people talking near me interrupting train of thought)
This topic is locked and can not be replied to.