DataMapper – Quick Reference

How would one specify the the combination of two fields must be unique? For example categories must have unique names within a domain:
class Category
  include DataMapper::Resource

  property :name, String, :unique_index => :u
  property :domain_id, Integer, :unique_index => :u

  belongs_to :domain
end
Source: stackoverflow.com

Leave a Reply

Your email address will not be published. Required fields are marked *