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
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 check_authorization_for_action
    if params[:controller].present?
      return true if params[:controller].match('sessions') || params[:controller].match('devise') || params[:controller].match('omniauth_callbacks')
    end
    redirect_to root_path, :alert => "无权限" unless can?(params[:action].to_sym, params[:controller].to_sym)
  end
def check_authorization_for_action if params [ :controller ] . present? return true if params [ :controller ] . match ( 'sessions' ) || params [ :controller ] . match ( 'devise' ) || params [ :controller ] . match ( 'omniauth_callbacks' ) end redirect_to root_path , :alert => "无权限" unles  can?( aram s [:acti o n].to_s y m , para m [:cont r oller].to_s y m ) end
Prevent CSRF attacks by raising an exception.
Prevent CSRF attacks by raising an exception .