aq1018/mongoid_taggable_with_context

Adding instance method has_tag?

Opened this issue · 1 comments

Is this something that could be added to the gem?

  # Public: Checks whether the subject has a tag or not
  #
  # tag - The Symbol name of the tag
  #
  # Returns Boolean
  def has_tag?(tag)
    self.tag_array_attributes.any? { |a| self.send(a).include?(tag.to_s) }
  end

I don't consider this a core feature, so I feel there is no need to put it in at this stage.

I'll keep this ticket open and if more people are requesting for this feature, then I will add it in.