Advertisement
Guest User

Untitled

a guest
Mar 31st, 2015
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. class PlayerSelectionsController < ApplicationController
  2. def create
  3. selection = PlayerSelection.new(player_selection_params.merge(user_id: current_user.id, game: Game.current_game))
  4. if selection.save
  5. render json: selection, status: 201, serializer: PlayerSelectionSerializer
  6. else
  7. render json: {errors: selection.errors}, status: 422
  8. end
  9. end
  10.  
  11. private
  12.  
  13. def player_selection_params
  14. params.require(:player_selection).permit(:player_id, :user_id)
  15. end
  16. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement