Displaying 1 result from an estimated 1 matches for "options_skus".
Did you mean:
options_plus
2006 Nov 08
0
Prevent an object from being destroyed in HABTM relationship
..._belongs_to_many :options
end
class Option < ActiveRecord::Base
has_and_belongs_to_many :skus
end
By default if I destroy an Option any relationships between Options and
Skus will be removed as well.
But, I want to prevent an Option from being destroyed when it is
associated with a Sku in the options_skus table. So the only way to
destroy an Option is to first remove each relationship. Is this
possible to do in the model? Is there a particular Rails way to do it?
Thanks for any help or suggestions you may have!
Ian Neubert
--~--~---------~--~----~------------~-------~--~----~
You received this...