class Category include DataMapper::Resource property :name, String, :unique_index => :u property :domain_id, Integer, :unique_index => :u belongs_to :domain endSource: stackoverflow.com
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: