search for: find_by_game_id_and_user_id

Displaying 1 result from an estimated 1 matches for "find_by_game_id_and_user_id".

2006 Apr 05
0
Is there AR magic for this?
...ind(session[:user_id]) @game = Game.find(params[:id]) @player = @game.players.detect { |p| p.user_id = @user.id } It works, and I''m likely to use the players list later anyway, but I feel like there should be a simple way to get the Player without loading all the players. I suppose Player.find_by_game_id_and_user_id(@game.id, @user.id) would work, but it isn''t a whole lot nicer. I''m hoping for something like Player.find_by_owners(:user => @user, :game => @game). --Greg