I’m having an issue using collection_select to create a drop down menu. all the guides say that this
<%= collection_select(:page, :user_id, @users, :id, :full_name) %>
should work but when I run the server, instead of a list of users appearing it’s just a blank list. The associations are that page belongs a user and a user has many pages, and there are users in the database that should be obtained in the controller when I call @users = User.all
Any idea on how to get the drop down list to populate?
Do you load anything into the
@usersvariable in yourPageController?If it does not belong (semantically) to the controller, make it a helper method
and in the view
Check also in the console that
:full_nameis a proper method of a User instanceEdit: proposal for a
full_namemethod with fallback