app/helpers/administrator_sessions_helper.rb
# Returns the current logged-in administrator (if any).
Returns the current logged-in administrator (if any).
Returns the current logged - in administrator ( if any ) .
def current_administrator
        if (administrator_id = session[:administrator_id])
            @current_administrator ||= Administrator.find_by(id: session[:administrator_id])
        elsif (administrator_id = cookies.signed[:administrator_id])
            administrator = Administrator.find_by(id: administrator_id)
            if administrator && administrator.authenticated?(cookies[:remember_token])
                administrator_log_in administrator
                @current_administrator = administrator 
            end
        end
    end
def current_administrator if ( administrator_id = session [ :administrator_id ] ) @current_administrator ||= Administrator . find_by ( id : session [ :administrator_id ] ) elsif ( administrator_id = cookies . signed [ :administrator_id ] ) administrator = Administrator . find_by ( id : administrator_id ) if administrator && administrator . authenticated? ( cookies [ :remember_token ] ) administrator_log_in administrator @current_administrator = administrator end end end
Returns the current logged-in administrator (if any).
Returns the current logged - in administrator ( if any ) .