0
I’d like to know how to make one 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 regarding the same subject. Assuming I have 3 courses related to the internship.
When I use the action update and update the related courses to 2, Rails will automatically delete that link that is no longer present in the update?