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?

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

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs