I have created a categories model with a migration with a category_id (basically everything Mackenzie Child does in his video https://www.youtube.com/watch?v=814gCeOpM4o from 25minutes) and I want it to show up in my form.
It doesn't work, my collection_select
wont show up on screen but it will show up in the source code, and when I 'remove' the css- framework materialize.
My code:
<div class="container">
<div class="row">
<%= form_for @post do |f| %>
<%= f.collection_select :category_id, Category.all, :id, :name, { prompt: "Choose a category" } %>
<br>
<%= f.label :title %>
<%= f.text_field :title %>
<br>
<br>
<div class="row">
<div class="input-field col s12">
<%= f.label :text %>
<%= f.text_area :text, class: "materialize-textarea" %>
</div>
</div>
<br>
<br>
<%= f.label :creator %>
<%= f.text_field :creator %><br>
<%= f.submit %>
<% end %>
</div>
How it's displayed in the source code:
<select name="post[category_id]" id="post_category_id"><option value="">Choose a category</option>
<option value="1">Marketing</option>
<option value="2">Technology</option>
<option value="3">Programming</option>
<option value="4">Health and Fitness</option>
</select>