Skip to content

Instantly share code, notes, and snippets.

@MOPineyro
Created February 4, 2015 00:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MOPineyro/4112faa8ba1ba7588da3 to your computer and use it in GitHub Desktop.
Save MOPineyro/4112faa8ba1ba7588da3 to your computer and use it in GitHub Desktop.
Slow PlayerSelections Controller
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