Created
March 1, 2012 23:19
-
-
Save Sephi-Chan/1953958 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UsersController < ApplicationController | |
rescue_from Location::NotAround, with: :handle_not_around_errors | |
def new | |
@user = User.new | |
end | |
def create | |
@user = User.new(params[:user]) | |
@user.persistence_token = User.generate_persistence_token | |
@user.location = Location.find_available_location | |
if @user.save | |
cookies.permanent[:persistence_token] = @user.persistence_token | |
redirect_to root_path | |
else | |
render :new | |
end | |
end | |
def move | |
x = params[:x].to_i | |
y = params[:y].to_i | |
current_user.move(x, y) | |
redirect_to game_path | |
end | |
private | |
def handle_not_around_errors | |
do_somethind | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment