Class: ApplicationController

Inherits:
ActionController::Base
  • Object
show all
Defined in:
app/controllers/application_controller.rb

Instance Method Summary collapse

Instance Method Details

#check_routeObject



24
25
26
27
28
29
# File 'app/controllers/application_controller.rb', line 24

def check_route
  if params[:controller]!="apis"
    url = "#{params[:controller].gsub(/\//, "_")}_#{params[:action]}"
    authorize! :manage, url.to_sym, :message => "你没有访问权限"
  end
end

#current_abilityObject



16
17
18
# File 'app/controllers/application_controller.rb', line 16

def current_ability
  @current_ability ||= Ability.new(@current_user)
end

#set_current_userObject



20
21
22
# File 'app/controllers/application_controller.rb', line 20

def set_current_user
  @current_user = session[:member_id] ? Member.where(:id => session[:member_id].to_i, :freezed => 0).first : nil
end