Class: Tag
- Inherits:
-
ActsAsTaggableOn::Tag
- Object
- ActsAsTaggableOn::Tag
- Tag
- Defined in:
- app/models/polymorphic/tag.rb
Overview
Copyright © 2008-2013 Michael Dvorkin and contributors.
Fat Free CRM is freely distributable under the terms of MIT license. See MIT-LICENSE file or www.opensource.org/licenses/mit-license.php
Instance Method Summary collapse
-
#model_tagging_counts ⇒ Object
Returns a count of taggings per model klass e.g.
-
#no_associated_field_groups ⇒ Object
Don’t allow a tag to be deleted if it is associated with a Field Group.
Instance Method Details
#model_tagging_counts ⇒ Object
Returns a count of taggings per model klass e.g. => 3, “Account” => 1
16 17 18 |
# File 'app/models/polymorphic/tag.rb', line 16 def model_tagging_counts Tagging.where(:tag_id => id).count(:group => :taggable_type) end |
#no_associated_field_groups ⇒ Object
Don’t allow a tag to be deleted if it is associated with a Field Group
10 11 12 |
# File 'app/models/polymorphic/tag.rb', line 10 def no_associated_field_groups FieldGroup.find_all_by_tag_id(self).none? end |