Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement