Sha256: e320aa96a94610615255ae02b75500892bdb8ffb0d74ffa678aa9d4faf18dd73

Contents?: true

Size: 421 Bytes

Versions: 2

Compression:

Stored size: 421 Bytes

Contents

class Tagging
  include DataMapper::Resource

  property :id,            Serial
  property :taggable_id,   Integer, :nullable => false
  property :taggable_type, Class,   :nullable => false
  property :tag_context,   String,  :nullable => false

  belongs_to :tag

  if respond_to?(:validates_present)
    validates_present :taggable_type, :taggable_id
  end

  def taggable
    taggable_type.get!(taggable_id)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
dm-tags-0.10.1 lib/dm-tags/tagging.rb
dm-tags-0.10.0 lib/dm-tags/tagging.rb