在我的模型中,游戏和用户之间存在多对多的关系。我怎样才能找到涉及给定玩家的所有游戏?
我试过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