Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Arthur Cast
3,619 PointsAdding a Drop down doesn't work
It won't show a drop down when I follow the tutorial steps. Adding a Dropdown
_form.html.erb
<%= simple_form_for(@status, html: {class: "form-horizontal"}) do |f| %>
<% if @status.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@status.errors.count, "error") %> prohibited this status from being saved:</h2>
<ul>
<% @status.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
</div>
<%= f.input :user_id, collections: User.all, label_method: :full_name %>
<%= f.input :content %>
<div class="form-actions">
<%= f.button :submit %>
</div>
<% end %>
4 Answers
Arthur Cast
3,619 PointsFound the issue
<%= f.input :user_id, collection**s**: User.all, label_method: :full_name %>
Should be
<%= f.input :user_id, collection: User.all, label_method: :full_name %>
Ty for help
Brandon Barrette
20,485 PointsDo you have more than 1 user in your system? Try adding a few more users.
Joseph Agunbiade
Courses Plus Student 1,905 PointsI have more than one user but I am having this same issue. What should I do? I'm using windows OS.
Alice Kasper
4,362 PointsFound a potential fix!
Try this: 1) go to models/user.rb
2) Make the defined full name is exactly like this:
def full_name
first_name + " " + last_name
end
3) Retry loading the page.
4) If it still doesn't work, copy and paste this in your _form.html.erb (I like having profile_name > full_name:
<%= simple_form_for(@status, html: {class: "form-horizontal"}) do |f| %>
<% if @status.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@status.errors.count, "error") %> prohibited this status from being saved:</h2>
<ul>
<% @status.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<%= f.input :user_id, collection: User.all, label_method: :profile_name %>
<%= f.input :content %>
<div class="form-actions">
<%= f.button :submit %>
</div>
<% end %>`