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?
--
Posted via http://www.ruby-forum.com/.
jim dandy
2006-Aug-11 05:34 UTC
[Rails] Re: how to access selected value in controller action
jim dandy wrote:> 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?Anyone have some insights into this? I want to be able to access the item that was selected from the controller and can''t figure out how to access it. Appreciate any advice! JD -- Posted via http://www.ruby-forum.com/.
MIke Cahill
2006-Aug-12 02:04 UTC
[Rails] Re: how to access selected value in controller action
Try adding a breakpoint in your controller and dump the params variable so you can see how it''s coded. jim dandy wrote:> jim dandy wrote: >> 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? > > Anyone have some insights into this? I want to be able to access the > item that was selected from the controller and can''t figure out how to > access it. > > Appreciate any advice! > > JD-- Posted via http://www.ruby-forum.com/.