Displaying 2 results from an estimated 2 matches for "price_code_id".
2006 Aug 09
2
has_many through delete issue
...g through the object model.
What I''m having trouble figuring out is how to delete Price records form
the association table.
Within one of my forms I have the following:
<%= link_to ''Destroy'', { :action => ''destroy_price'', :id => @media.id,
:price_code_id =>price_code.id }, :confirm => ''Are you sure?'', :post =>
true %>
Add here is the destroy_price action in the controller:
def destroy_price
Media.find(params[:id]).prices.find(params[:price_code_id]).destroy
redirect_to :action => ''show'', :id...
2006 Aug 09
2
how to access selected value in controller action
I have this in a view:
<%= start_form_tag :action => ''create_price'', :id => @media.id %>
<%= select("media", "price_code_id", PriceCode.find_all.collect {|pc|
[pc.name, pc.id ] }, { :include_blank => false }) %>
<%= submit_tag ''Add Price Code'' %>
<%= end_form_tag %>
My question is, how would I access the selected value in the
create_price action in the media controller?
--...