Skip to content

Instantly share code, notes, and snippets.

@marcelloma
Created October 11, 2011 17:37
Show Gist options
  • Save marcelloma/1278788 to your computer and use it in GitHub Desktop.
Save marcelloma/1278788 to your computer and use it in GitHub Desktop.
Actions
get '/login' do
haml :login
end
post '/login' do
player = Player.first_or_create(:name => params[:player_name])
session[:player] = player.name
redirect '/lobby'
end
get '/play/:id/use/:card' do
content_type :json
@game = Game.get(params[:id])
who_is = @game.who_is?(session[:player])
client.publish("/games/#{params[:id]}", :text=>"#{who_is.to_s} used card #{params[:card]}")
{:msg => 'SUCCESS'}.to_json
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment