app/controllers/application_controller.rb
def login_state_setup
    if session[:user_id]
      User.current = User.find_by_id(session[:user_id])
    else
      User.current = nil
    end

    if User.current
      User.current.access_token = session[:access_token]
    end

    return true
  end
# 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.
Prevent CSRF attacks by raising an exception . For APIs you may want to use : null_session instead .
def login_state_setup
    if session[:user_id]
      User.current = User.find_by_id(session[:user_id])
    else
      User.current = nil
    end
    if User.current
      User.current.access_token = session[:access_token]
    end
    return true
  end
def login_state_setup if session [ :user_id ] User . current = User . find_by_id ( session [ :user_id ] ) else User . current = nil end if User . current User . current . access_token = session [ :access_token ] end return true end
Prevent CSRF attacks by raising an exception.
Prevent CSRF attacks by raising an exception .