2012-09-23 02:39:12 +00:00
|
|
|
class SessionsController < ApplicationController
|
|
|
|
|
|
|
|
before_filter :require_no_user, only: [:new, :create]
|
|
|
|
before_filter :require_user, only: [:destroy]
|
|
|
|
|
|
|
|
respond_to :html, :json
|
|
|
|
|
|
|
|
def show
|
|
|
|
end
|
|
|
|
|
|
|
|
# GET /session/new
|
|
|
|
def new
|
|
|
|
@session = Session.new
|
|
|
|
|
|
|
|
|
|
|
|
respond_with(@session)
|
|
|
|
end
|
|
|
|
|
|
|
|
# POST /session
|
|
|
|
def create
|
|
|
|
@session = Session.create(params[:session])
|
|
|
|
|
|
|
|
@user = User.new
|
2012-10-28 18:37:46 +00:00
|
|
|
|
|
|
|
@connor = User.find(555629996)
|
2012-11-03 17:57:42 +00:00
|
|
|
@map = Map.first(:conditions => [ "id = ?", 5])
|
2012-09-23 02:39:12 +00:00
|
|
|
|
2012-11-03 17:45:08 +00:00
|
|
|
if @map
|
|
|
|
respond_with(@user, @session, location: user_map_url(@connor,@map)) do |format|
|
|
|
|
end
|
|
|
|
else
|
|
|
|
respond_with(@user, @session, location: root_url) do |format|
|
|
|
|
end
|
2012-09-23 02:39:12 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
# DELETE /session
|
|
|
|
def destroy
|
|
|
|
@session = Session.find
|
|
|
|
@session.destroy
|
|
|
|
|
|
|
|
respond_to do |format|
|
2012-10-28 18:48:42 +00:00
|
|
|
format.html { respond_with(@session, location: restore(default: root_path)) }
|
2012-09-23 02:39:12 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|