how to destroy the different corresponding ids of different connected tables from one interface's destroy
if my model is like:
class ss < ActiveRecord::Base has_many :ss_schedules end
class ssSchedule < ActiveRecord::Base belongs_to :ss end
class ssRuleMapping < ActiveRecord::Base belongs_to :ss belongs_to :ss_rules end
- now first query the same as stated above if i have main interface is ss.
- second query is 开发者_JS百科I hav a table called ss_rules which contains certain rules. If I want store the id of a certain rule in ss_rule_mappings as well as the id of 'ss' for which that rule is selected. hence ss_rule_mapping will contain id of itself, id of ss, id of rule. Thankyou
In your model association try something like this :
has_many :models, :dependent => :destroy
You can find documentation about this here and here
If you want help, edit your post with the code of concerned models
精彩评论