Sha256: 89ebc40a690e89dbab9026ede7441b5d5659a95c93f5fe5d7a18d15cb4ba6f7d

Contents?: true

Size: 405 Bytes

Versions: 17

Compression:

Stored size: 405 Bytes

Contents

module Writefully
  class Tag < ActiveRecord::Base
    self.table_name = "writefully_tags"

    has_many :taggings, dependent: :destroy
    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

17 entries across 17 versions & 1 rubygems

Version Path
writefully-0.8.2 app/models/writefully/tag.rb
writefully-0.8.1 app/models/writefully/tag.rb
writefully-0.8.0 app/models/writefully/tag.rb
writefully-0.7.1 app/models/writefully/tag.rb
writefully-0.6.12 app/models/writefully/tag.rb
writefully-0.6.11 app/models/writefully/tag.rb
writefully-0.6.10 app/models/writefully/tag.rb
writefully-0.6.9 app/models/writefully/tag.rb
writefully-0.6.7 app/models/writefully/tag.rb
writefully-0.6.6 app/models/writefully/tag.rb
writefully-0.6.5 app/models/writefully/tag.rb
writefully-0.6.4 app/models/writefully/tag.rb
writefully-0.6.3 app/models/writefully/tag.rb
writefully-0.6.2 app/models/writefully/tag.rb
writefully-0.5.1 app/models/writefully/tag.rb
writefully-0.5.0 app/models/writefully/tag.rb
writefully-0.4.10 app/models/writefully/tag.rb