How to assign a variable the current output of a select tag
问题 I'm having some trouble with a select tag. I want to assign a value to a variable depending on which name is shown on the select tag: <%= select('product', 'name' , @products.map { |s| [s.name, s.id] }, {}, {:class => "form-control"}) %> The values display correctly, but I want to assign the currently selected value to a variable so that it can be used later on the same page to display content with the relevant details of the selected product. For example: @product = currently_displayed_name