I would like to know how to do a form many to many in rails.
Here are my models:
class Course < ActiveRecord::Base
has_and_belongs_to_many :notices, dependent: :destroy
has_and_belongs_to_many :internships, dependent: :destroy
end
class Internship < ActiveRecord::Base
belongs_to :enterprise
has_and_belongs_to_many :courses
end
I also have another question about the same subject. Assuming I have 3 internship-related courses.
When I use action update and update related courses to 2, will rails automatically delete that relationship that is no longer present in the update?