datamapper multi-field unique index
datamapper, indexing, ruby
Solution
Did you try to define both properties as keys? Not sure I have tried it but that way they should become a composite key.
property :name, String, :key => true
property :category, Integer, :key => true
Problem
In Datamapper, 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, :index=>true #must be unique for a given domain belongs_to :domain end ```