Forum: Ruby on Rails Using dropdown to choose ID (noob question!)

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.
E87b1ce5681dff3967a4584a7edad915?d=identicon&s=25 morykon (Guest)
on 2005-12-07 02:23
(Received via mailing list)
I'm trying to use a dropdown to select the id of a record to load.

My view code:

<%= form_remote_tag :update=>"editAread", :url => {:action =>
"loadArea"} %>
<%=collection_select(:area, :id, @areas, :id, :name ) %> <%=
submit_tag 'Load' %>
<%= end_form_tag %>


Then the controller code:

  def loadArea
      @editArea=ContentArea.find(params[:area])
      render :partial => "editArea"
  end


But I get this error:

Unknown key(s): id


There is an id field in the content_areas table. What am I missing here?
C64e63b70be7dfed8b0742540b8b27e5?d=identicon&s=25 mrj (Guest)
on 2005-12-07 04:53
(Received via mailing list)
Brian Morykon wrote:

> <%=collection_select(:area, :id, @areas, :id, :name ) %> <%=
>       @editArea=ContentArea.find(params[:area])

@editArea=ContentArea.find(params[:area][:id])

--
We develop, watch us RoR, in numbers too big to ignore.
This topic is locked and can not be replied to.