Rails - How to call values from one model into another model form
<p>I'm working on some app and I have 2 models. Categories in which I create category names and Question. Category has_many questions and Question belongs_to Category. <br>
I've added category_id to Question model. </p>

<p>Now I need to take all Category_names and display them in form where I create Question so User can choose in which category_name will save question.</p>

<p>I've tried something like this in firs line of code but not working.</p>

<pre><code>&lt;%= f.input :category_id, Category.all.map(&amp;:name) %&gt;
&lt;%= f.input :question_name, wrapper: :vertical_text_input, as: :text %&gt;
&lt;%= link_to "Markdown help", "http://assemble.io/docs/Cheatsheet-Markdown.html", target: "_blank", class: "right" %&gt;
&lt;%= f.input :answer %&gt;
&lt;%= f.input :image, as: :attachinary %&gt;
</code></pre>

<p><strong>QUESTION: How to display all Category names in form where I create new Questions?</strong> </p>