2017-01-18 67 views

回答

0
# app/controllers/invitations_controller.rb 
class Devise::InvitationsController < DeviseController 
    ... 
    before_action :is_admin?, :only => [:new, :create] 
    ... 

private 

    def is_admin? 
     current_user.role == 'admin' 
    end 
end 
相關問題