Skip to content

Instantly share code, notes, and snippets.

@johnhamelink
Created February 24, 2016 17:05
Show Gist options
  • Select an option

  • Save johnhamelink/fdea84282ec6536ac8c6 to your computer and use it in GitHub Desktop.

Select an option

Save johnhamelink/fdea84282ec6536ac8c6 to your computer and use it in GitHub Desktop.
if play.players.find_by_session_id(current_user.id)
return uhoh!('Player with session ID is already on the play roster', 409)
end
player = play.players.new(
session_id: current_user.id,
origin: 'Session',
state: Player.states[:requested_to_join],
name: current_user.name
)
UpdatePlayerService.new.create(
current_user: current_user,
player: player
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment