ga-dc / wdi5-project3

Project 3
0 stars 5 forks source link

Getting params from collection_select #66

Closed lmdragun closed 9 years ago

lmdragun commented 9 years ago

I'm trying to use a collection_select on a form, I want them to be able to choose from objects in a different table, and then whatever they choose to become part of the parameters in the new entry (Loan.new (lender_id: params[])). It might just be where I got the form from, but I'm not sure how to pull the selection from the form into the controller.

Example code: <%= collection_select(:post, :id, User.order('username'), :id, :username) %>

jshawl commented 9 years ago

When the form is submitted, the selected option will be available in the params

lmdragun commented 9 years ago

So would it be used as params[:user_id]?