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
18 19 20 |
# File 'app/models/polymorphic/tag.rb', line 18 def model_tagging_counts Tagging.where(tag_id: id).group(:taggable_type).count end |
#no_associated_field_groups ⇒ Object
Don’t allow a tag to be deleted if it is associated with a Field Group
12 13 14 |
# File 'app/models/polymorphic/tag.rb', line 12 def no_associated_field_groups FieldGroup.where(tag_id: id).none? end |