Sha256: 34ef4f83a888cd4ee78809af18630dfbd69ee495dec9af28d845daa07eaba2af

Contents?: true

Size: 532 Bytes

Versions: 6

Compression:

Stored size: 532 Bytes

Contents

module Effective
  class Tagging < ApplicationRecord
    self.table_name = (EffectivePages.taggings_table_name || :taggings).to_s

    belongs_to :tag, class_name: 'Effective::Tag'
    belongs_to :taggable, polymorphic: true

    scope :deep, -> { all }

    effective_resource do
      tag_id          :integer
      taggable_id     :integer
      taggable_type   :string

      timestamps
    end

    validates :tag_id, uniqueness: { scope: [:taggable_type, :taggable_id] }

    public

    def to_s
      name
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
effective_pages-3.7.5 app/models/effective/tagging.rb
effective_pages-3.7.4 app/models/effective/tagging.rb
effective_pages-3.7.3 app/models/effective/tagging.rb
effective_pages-3.7.2 app/models/effective/tagging.rb
effective_pages-3.7.1 app/models/effective/tagging.rb
effective_pages-3.7.0 app/models/effective/tagging.rb