module Polytag::Concerns::Taggable::ClassHelpers

Public Instance Methods

has_tag(tag, args = {}) click to toggle source
# File lib/polytag/concerns/taggable/class_helpers.rb, line 5
def has_tag(tag, args = {})
  query = ::Polytag.get tag: tag,
    tag_group: args[:tag_group],
    owner: args[:tag_group_owner],
    foc: nil

  includes(:tags).where(polytag_connections: {polytag_tag_id: query.select(:id)})
end