Using dropdown to choose ID (noob question!)


#1

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?


#2

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.