app/controllers/application_controller.rb
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
# protect_from_forgery with: :exception
# before_filter :require_user
Prevent CSRF attacks by raising an exception.
For APIs, you may want to use :null_session instead.
Prevent CSRF attacks by raising an exception . For APIs you may want to use : null_session instead .
def current_user
    if !defined?(@current_user) && session[:user_id] && session[:user_sha]
      user = User.find(session[:user_id])
      @current_user = user.sha == session[:user_sha] ? user : nil
    end
    @current_user
  end
def current_user if ! defined? ( @current_user ) && session [ :user_id ] && session [ :user_sha ] user = User . find ( session [ :user_id ] ) @current_user = user . sha == session [ :user_sha ] ? user : nil end @current_user end
Prevent CSRF attacks by raising an exception.
Prevent CSRF attacks by raising an exception .