Class: Tagging

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/tagging.rb

Overview

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.

Constant Summary

GENERIC =

tagging_kinds

0
USER =

table defaults

1
SHARED =
2
CONTENT =
3
CONTENT_PRIMARY =

for public communities, indicates the primary content tag for the community, if more than one

4
ALL =

special class of 'all' for caching purposes

42

Instance Method Summary (collapse)

Instance Method Details

- (Object) before_destroy

This callback makes sure that an orphaned Tag is deleted if it no longer tags anything.



31
32
33
# File 'app/models/tagging.rb', line 31

def before_destroy
  tag.destroy_without_callbacks if tag and tag.taggings.count == 1
end