ubuseral
ubuseral

Reputation: 427

Rails: select_tag

i tried this here: http://api.rubyonrails.org/classes/ActionView/Helpers/FormOptionsHelper.html

exactly this:

<%= collection_select(:sportlers, :sportlers_id, Sportler.all, :id, :name) %>

But there dont is written, how to get the selected value from the collection_select.

Im helpless, do you work with somethings like this?

Upvotes: 0

Views: 114

Answers (1)

n_i_c_k
n_i_c_k

Reputation: 1534

I think collection_select will take the first two parameters, the object and the method, and use the values to make a hash, so in your case, you can access the values in your controllers like:

params[:sportlers][:sportlers_id]

Upvotes: 1

Related Questions