Sha256: 112249e2571ab9c6a8c71be2c37a2cf494f8b20cbceabf59481b72e7be764170
Contents?: true
Size: 533 Bytes
Versions: 2
Compression:
Stored size: 533 Bytes
Contents
# encoding: utf-8 class Tagging < ActiveRecord::Base belongs_to :tag belongs_to :taggable, polymorphic: true validates_presence_of :taggable_id, :taggable_type validates :tag_id, presence: true, uniqueness: { scope: [:taggable_type, :taggable_id] } def self.tagged_class(taggable) ActiveRecord::Base.send( :class_of_active_record_descendant, taggable.class ).to_s end def self.find_taggable(tagged_class, tagged_id) tagged_class.constantize.find(tagged_id) end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
pages_core-3.4.3 | app/models/tagging.rb |
pages_core-3.4.2 | app/models/tagging.rb |