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.
精彩评论