class Tagging
  include DataMapper::Resource

  property :id,            Serial
  property :taggable_id,   Integer, :required => true
  property :taggable_type, Class,   :required => true
  property :tag_context,   String,  :required => true

  belongs_to :tag

  def taggable
    taggable_type.get!(taggable_id)
  end
end

class Tagging
  include DataMapper::Resource

  property :id,            Serial
  property :taggable_id,   Integer, :required => true, :min => 1
  property :taggable_type, Class,   :required => true
  property :tag_context,   String,  :required => true

  belongs_to :tag

  def taggable
    taggable_type.get!(taggable_id)
  end
end

Support dm-constraints in explicitly defined FK
[dm-tags] Support dm-constraints in explicitly defined FK
