I have installed my many-to-many models:
class Workshop < ActiveRecord::Base
has_many :workshop_students
has_many :students, :through => :student_workshops
accepts_nested_attributes_for :students
end
class Student < ActiveRecord::Base
has_many :student_workshops
has_many :workshops, :through => :student_workshops
accepts_nested_attributes_for :products
end
class StudentWorkshop < ActiveRecord::Base
belongs_to :student
belongs_to :workshop
end
As you can see above, a student can have many seminars, and there can be many students in a workshop.
I looked at the following Rails tracks: here and here . And most of the Internet sources I come across only show how to make nested forms to create new objects in the parent form.
I do not want to create a new object. I want to add an existing object to the parent form. For example. If I decide to create a new workshop, I would like to appoint existing students to the workshop.
, , ? -, , /?
- , .