Friday 15 July 2011

ruby on rails - HABTM relationship with "dependent: :destroy" -



ruby on rails - HABTM relationship with "dependent: :destroy" -

i have 3 models in test rails 4 project.

company project contact

a company has_many contacts , has_many projects. project belongs_to company. contact belongs_to company.

i want able create relationship between project , contact. there alternative utilize has_many :through relation display companies contacts or projects.

if create separate habtm table won't able utilize "dependent: :destroy" option.

how can create relationship , allow dependent on company? when alter contacts related company won't have corrupt info in db , old relationships destroyed.

ruby-on-rails ruby-on-rails-4 has-and-belongs-to-many

No comments:

Post a Comment