Created
February 4, 2015 00:11
-
-
Save MOPineyro/4112faa8ba1ba7588da3 to your computer and use it in GitHub Desktop.
Slow PlayerSelections Controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PlayerSelectionsController < ApplicationController | |
def create | |
selection = PlayerSelection.new(player_selection_params.merge(user_id: current_user.id, game: Game.current_game)) | |
if selection.save | |
render json: selection, status: 201, serializer: PlayerSelectionSerializer | |
else | |
render json: {errors: selection.errors}, status: 422 | |
end | |
end | |
private | |
def player_selection_params | |
params.require(:player_selection).permit(:player_id, :user_id) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment