I made a drop down list using collection_select
<%= collection_select(:page, :user_id, @users, :id, :full_name) %>
that part works fine. I am having trouble on saving it/processing it using the controller, the APIdock isn’t very helpful on that part and I haven’t been able to get the one example I found to work. Can anyone explain to me how I can process the selected value in the controller?
You will have a value
which will correspond to the value selected in the form. You can see it inspecting the
paramsvariable.IT is a number, the ID of the selected user. You could load the user by
but it’s useless. In fact, if the
user_idproperty of the page is accessible, then with the usualor
you will get the user in the page as
@page.user.