Sha256: b199df8f7078fc096970cba609493894772cf85a1cd625dcede9985125186cc3

Contents?: true

Size: 913 Bytes

Versions: 22

Compression:

Stored size: 913 Bytes

Contents

# The Tagging join model. This model is automatically generated and added to your app if you run the tagging generator included with has_many_polymorphs.

class Tagging < ActiveRecord::Base 
 
  belongs_to :<%= parent_association_name -%><%= ", :foreign_key => \"#{parent_association_name}_id\", :class_name => \"Tag\"" if options[:self_referential] %>
  belongs_to :taggable, :polymorphic => true
  
  # If you also need to use <tt>acts_as_list</tt>, you will have to manage the tagging positions manually by creating decorated join records when you associate Tags with taggables.
  # acts_as_list :scope => :taggable
    
  # This callback makes sure that an orphaned <tt>Tag</tt> is deleted if it no longer tags anything.
  def after_destroy
    <%= parent_association_name -%>.destroy_without_callbacks if <%= parent_association_name -%> and <%= parent_association_name -%>.taggings.count == 0
  end    
end

Version data entries

22 entries across 22 versions & 4 rubygems

Version Path
radiant-tags-extension-1.6.10 vendor/plugins/has_many_polymorphs/generators/tagging/templates/tagging.rb
johnsbrn-has_many_polymorphs-2.13.1 generators/tagging/templates/tagging.rb
johnsbrn-has_many_polymorphs-2.13.3 generators/tagging/templates/tagging.rb
johnsbrn-has_many_polymorphs-2.13.4 generators/tagging/templates/tagging.rb
johnsbrn-has_many_polymorphs-2.13 generators/tagging/templates/tagging.rb
radiant-tags-extension-1.6.9 vendor/plugins/has_many_polymorphs/generators/tagging/templates/tagging.rb
radiant-tags-extension-1.6.8 vendor/plugins/has_many_polymorphs/generators/tagging/templates/tagging.rb
radiant-tags-extension-1.6.7 vendor/plugins/has_many_polymorphs/generators/tagging/templates/tagging.rb
radiant-tags-extension-1.6.6 vendor/plugins/has_many_polymorphs/generators/tagging/templates/tagging.rb
radiant-tags-extension-1.6.5 vendor/plugins/has_many_polymorphs/generators/tagging/templates/tagging.rb
radiant-tags-extension-1.6.4 vendor/plugins/has_many_polymorphs/generators/tagging/templates/tagging.rb
radiant-tags-extension-1.6.3 vendor/plugins/has_many_polymorphs/generators/tagging/templates/tagging.rb
radiant-tags-extension-1.6.2 vendor/plugins/has_many_polymorphs/generators/tagging/templates/tagging.rb
radiant-tags-extension-1.6.1 vendor/plugins/has_many_polymorphs/generators/tagging/templates/tagging.rb
radiant-tags-extension-1.6.0 vendor/plugins/has_many_polymorphs/generators/tagging/templates/tagging.rb
radiant-tags-extension-1.5.1 vendor/plugins/has_many_polymorphs/generators/tagging/templates/tagging.rb
has_many_polymorphs-2.2 generators/tagging/templates/tagging.rb
has_many_polymorphs-2.12 generators/tagging/templates/tagging.rb
has_many_polymorphs-2.13 generators/tagging/templates/tagging.rb
spree-0.6.0 vendor/plugins/has_many_polymorphs/generators/tagging/templates/tagging.rb