mandytrex / workout_buddy

0 stars 0 forks source link

Rails form issue in users/new #3

Closed mandytrex closed 9 years ago

mandytrex commented 9 years ago

I am trying to add a drop down selection to my users/new _form view. The drop down should contain a list of all activities.

This is the porition of the form I am working with for it:

<%= f.label :activity %> <%= f.collection_select(:user, :activity_id, Activity.all, :id, :name) %>

It's not working and I'm confused why. Any insight on how to properly set up the collection_select form helper? I am not really understanding the documentation.

Thanks Amanda

@harimohanraj89 @htella @DrRobotmck

htella commented 9 years ago

is your latest code pushed?

mandytrex commented 9 years ago

yes, my latest code is pushed. in views/users/_form you will see i figured out how to add selections to fields in my form.

however, i want users to be able to select activities in the form of checkboxes. activities are seeded into my database in a many to many relationship with users

@htella

harimohanraj89 commented 9 years ago

It looks like Rails has a convenient way to achieve this.

http://apidock.com/rails/v4.0.2/ActionView/Helpers/FormOptionsHelper/collection_check_boxes