How to assign a variable the current output of a select tag
<p>I'm having some trouble with a <code>select</code> tag.</p>

<p>I want to assign a value to a variable depending on which name is shown on the select tag:</p>

<pre><code>&lt;%= select('product', 'name' , @products.map { |s| [s.name, s.id] }, {}, {:class =&gt; "form-control"}) %&gt;
</code></pre>

<p>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.</p>

<p>For example:</p>

<pre><code>@product = currently_displayed_name
</code></pre>

<p>Is this possible with Rails and how to do it? Or do I might need to use another resource?</p>