开发者

Rails 3: Is there anything wrong with the syntax for my named scope?

Is there anything wrong with the syntax for my named scope? Because it ain't workin...

scope 开发者_如何学运维:that_is_registered_in_tournament_with_username, lambda { |tourney_id, name| where("username = ? and tournament_id = ?", name, tourney_id).first }

Thanks so much!


I think the problem is first. First actually picks the first object from a given relation. Thus, it's actually an object and not a relation. I think that if you lose .first, it will work.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜