Ask A Question

Notifications

You’re not receiving notifications from this thread.

How do I assign multiple user_id's to one work order record

Austin Klenk asked in Rails

i got a question ive been scratching my head for a few days on a solution to a problem. I currently have work order that we assign a single user to and im trying to figure out the best way to assign multiple users to a single work order so if multiple people work on one work order at the same time they will have their own time card as well. I currently have a belongs_to association on the order model and on the user model I have has_many :orders. On my form i have a collection select that accepts multiple: true and in the database (pg) under the order table i have a user_id: integer column. Is there any additional steps to make this work? also in the order controller, i have user_id: [] under the order_params to accept the nested array or selected users in the form. Any pointers would be greatly appreciated.

Reply
Join the discussion
Create an account Log in

Want to stay up-to-date with Ruby on Rails?

Join 86,946+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.