2 # The Commenting join model. This model is automatically generated and added to your app if you run the commenting generator.
4 class Commenting < ActiveRecord::Base
6 belongs_to :<%= parent_association_name -%><%= ", :foreign_key => \"#{parent_association_name}_id\", :class_name => \"Comment\"" if options[:self_referential] %>
7 belongs_to :commentable, :polymorphic => true
9 # This callback makes sure that an orphaned <tt>Comment</tt> is deleted if it no longer tags anything.
11 <%= parent_association_name -%>.destroy_without_callbacks if <%= parent_association_name -%> and <%= parent_association_name -%>.commentings.count == 1