1
我给我的宁静资源添加了新动作,我如何使用cancan对它进行授权。cancan新动作
页控制器:
load_and_authorize_resource
def index
end
def show
end
def new
end
def create
end
def edit
end
def update
end
def destroy
end
def mynewaction
end
能力模型:
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new
can :create, Page
can :mynewmethod, Page #does it work?
end
是的,它的工作原理。你也可以把方法传递给数组,如 can [:create,:mynewmethod],Page – 2011-04-13 22:24:36
你会接受答案吗? – 2011-11-27 23:12:16