DataMapper ドキュメントのタグ/写真の例を挙げてください。
class Photo
include DataMapper::Resource
property :id, Serial
has n, :taggings
has n, :tags, :through => :taggings
end
class Tag
include DataMapper::Resource
property :id, Serial
has n, :taggings
has n, :photos, :through => :taggings
end
class Tagging
include DataMapper::Resource
belongs_to :tag, :key => true
belongs_to :photo, :key => true
end
写真がないタグをすべて選択したい
Tag.select { |tag| tag.photos.size < 1}
しかし、もっと Datamapper 構文が欲しいです。何かのようなもの
Tag.all :photos.count.lt => 1 #not works
これを行う方法はありますか?高度なクエリに関する優れた Datamapper ドキュメントを知っている人はいますか? このサイトのドキュメントは非常に優れていますが、基本的すぎます。
Tkz