Class: Tag

Inherits:
ActsAsTaggableOn::Tag
  • Object
show all
Defined in:
app/models/polymorphic/tag.rb

Instance Method Summary collapse

Instance Method Details

#model_tagging_countsObject

Returns a count of taggings per model klass e.g. => 3, “Account” => 1



11
12
13
# File 'app/models/polymorphic/tag.rb', line 11

def model_tagging_counts
  Tagging.where(:tag_id => id).count(:group => :taggable_type)
end

#no_associated_field_groupsObject

Don’t allow a tag to be deleted if it is associated with a Field Group



5
6
7
# File 'app/models/polymorphic/tag.rb', line 5

def no_associated_field_groups
  FieldGroup.find_all_by_tag_id(self).none?
end