我正在使用cancan,但我遇到了小问题..
my ability.rb
can :manage, Department
can :manage, Review
我有 2 个案例,它适用于案例 1,但不幸的是不适用于案例 2
case 1
我的部门主管
load_and_authorize_resource :message => "Unable to read this article."
Here it works because in this controller
I use model Department
现在我的评论控制器
case 2
class ReviewsController < ApplicationController
load_and_authorize_resource :message => "Unable to read this article."
layout 'system'
respond_to :html, :json
add_breadcrumb "Home", :root_url
add_breadcrumb "Reviews", :reviews_path
def index
@page_title = "Reviews List"
@reviews = Evaluate.all
end
def show
@page_title = "Review setting of selected Job title"
@review = Evaluate.find(params[:id])
end
我怎么解决这个问题 ?
Is there a fix rule in cancan that model name
should be related to the controller name?
Departments(controller) should have Department(model)?
How can we implement cancan in Reviews(controller) which have Evaluate(model)?