Skip to content

Instantly share code, notes, and snippets.

@patmaddox
Created January 3, 2014 01:15
Show Gist options
  • Select an option

  • Save patmaddox/8230726 to your computer and use it in GitHub Desktop.

Select an option

Save patmaddox/8230726 to your computer and use it in GitHub Desktop.
for Casey
class ApplicationController
def require_login
unless current_user
session[:return_to] = request.uri
redirect_to login_path
end
end
end
class LoginsController
def create
if user = User.authenticate(params[:username], params[:password])
session[:current_user_id] = user.id
redirect_to(session.delete(:return_to) || home_path)
else
render template: 'login'
end
end
end
class FlowLogsController
before_filter :require_login
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment