私は3つの関連モデルを持っています:
class Transaction
include DataMapper::Resource
property :id, Serial
property :volume, Float
property :deal_date, Date
belongs_to :buyer
belongs_to :seller
end
class Seller
include DataMapper::Resource
property :id, Serial
property :name, String
has n, :transactions
end
class Buyer
include DataMapper::Resource
property :id, Serial
property :name, String, :length => 255, :index => true, :unique => true
has n, :transactions
end
いくつかの条件でトランザクションへのクエリを作成したい:
x < volume < y
and
a < deal_date < b
and
( buyer.name like key_word OR seller.name like key_word )
Datamapper で 2 つの LIKE の間に OR 条件を作成するにはどうすればよいですか?