0
在我的模型中,遊戲和用戶之間存在多對多的關係。我怎樣才能找到涉及給定玩家的所有遊戲?查找涉及玩家的遊戲
我試圖Game.all(Game.users.include?(u))
但有一個NoMethodError
約include?
這裏是我的模型每http://datamapper.org/docs/associations.html
class User
include DataMapper::Resource
property :id, Serial
has n, :games, :through => Resource
end
class Game
include DataMapper::Resource
property :id, Serial
has n, :users, :through => Resource
end