Skip to content

Instantly share code, notes, and snippets.

@Heavyblade
Created June 28, 2013 14:47
Show Gist options
  • Select an option

  • Save Heavyblade/5885237 to your computer and use it in GitHub Desktop.

Select an option

Save Heavyblade/5885237 to your computer and use it in GitHub Desktop.
class ApplicationController < ActionController::Base
protect_from_forgery
def index
@users = User.all
render :template => "applications/index"
end
def current_user
@current_user ||= warden.authenticate(:scope => :user)
if @current_user && params[:app_name].present?
return @current_user.application.try(:name) == params[:app_name]
else
session[:app_name] = params[:app_name]
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment