i'm new to rails and am having difficulty figuring out how to use the output of a select form in rails 3. the following is my select tag:
<%= form_for(:order, :url => {:action => 'create_order'}) do |f| %>
<%= select_tag( "experience_id", options_from_collection_for_select(@experiences, :experience_id, :experience_type)) %>
<% frame = frame.id %>
<% material = material.id %>
<%= f.hidden_field :frame_id, :value => frame %>
<%= f.hidden_field :material_id, :value => material %>
<div class="submit-button">
<%= submit_tag("Get Started!") %>
</div>
it might be a little confusing out of context but ineed to get the experience id value and assign it to a variable in the controller method for 'create' which currently looks like this:
def create_order
#need to assign the submitted select_tag value and assign it to @order.experience_id
@order = Order.new(params[:order]).update_attributes(params[:order])
@order_id = Order.last.id
redirect_to(:action => 'drivetrain', :id => @order_id )
end
and the experience id is getting passed through as seen in a code error i triggered. is the experience_id not getting associated with :order?
{"commit"=>"Get Started!",
"authenticity_token"=>"LrE2oOk2AkoUJbddC2crjnA5j4tIdxLGla52LWISx08=",
"utf8"=>"✓",
"order"=>{"material_id"=>"1",
"frame_id"=>"1"},
"experience_id"=>"4"}
thanks for any help!