Sha256: 87fc60f9c7cbf4ad04faefb81224eba637e5c566e2efe67390a647b4ff6618b5

Contents?: true

Size: 343 Bytes

Versions: 1

Compression:

Stored size: 343 Bytes

Contents

module Writefully
  class Tag < ActiveRecord::Base
    has_many :taggings
    has_many :posts, through: :taggings

    class << self 
      def ids_from_tokens tokens
        taxon = Taxon.new(tokens, pluck(:name), name)

        import taxon.non_existing
        where(slug: tokens.map { |t| t.parameterize }).ids
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
writefully-0.3.6 app/models/writefully/tag.rb