Reputation: 1784
So suppose I have two Models -- Project and Task
I want user to be able to select an existing project and assign a task to it.
This needs to be done in a task_form, in other words, I use Task Controller. I know if it's a project form, I can simply create a nested form using accepts_nested_attributes_for in my Project model. However, the problem is I need to refer back to a higher level model.
Thanks in advance.
Upvotes: 0
Views: 67
Reputation: 4155
One option is to create a view for the task form where there is a drop down box of all existing projects. You can use collection_select to create the multiselect and then just have it put the id of the project in the project_id column.
Upvotes: 1