I have a big issue with the select tag. In my view I have the following code:
<%= select 'lw', Logicalwarehouse.all %>
In my controller:
....
@logical_wh = Logicalwarehouse.find(params['lw'])
@project.logicalwarehouses << @logical_wh
respond_to do |format|
if @project.update_attributes(params[:project])
flash[:notice] = 'Project was successfully updated.'
format.html { redirect_to(@project) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @project.errors, :status => :unprocessable_entity }
end
end
...
Alternatively, I want use a drop.down menu in my view that will let me choose between all Logicalwarehouse objects that will return a chosen object inside the lw variable, back to controller. I am having an issue with the view select field. Rails returns an error that it has the wrong number of arguments (2 for 3), any suggestions?
Thank you all
I don’t know the name of an attribute that has description of your Logicalwarehouse. I assume it’s
name:UPD:
Selected
idwill be available throughparams[:lw][:id].