CanCan은 InheritedResouces를 사용하는 동안 컨트롤러에서 인덱스 동작으로 인해 이상하게 동작합니다. 내가 ability.rb에InheritedResources/CanCan 문제
can :read, Question do |question|
false
end
이있는 경우 - 그것은 블록의 반환 값에 불구하고 작업에 대한 액세스 권한을 부여합니다. 이 줄을 제거하면 - "이 페이지에 액세스 할 권한이 없습니다.". 아래 컨트롤러 코드 :
# encoding: utf-8
class QuestionsController < InheritedResources::Base
actions :all, :except => [:edit, :update]
before_filter :authenticate_user!, :except => [:show]
load_and_authorize_resource :except => [:show]
end
InheritedResources의 버전을 사용하고 있습니까? –
Gemfile.lock의 1.3.0 – tipugin
이 부분을 보시려면 https://github.com/railsbp/rails_best_practices/issues/66 –