2012-01-25 3 views
1

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 
+0

InheritedResources의 버전을 사용하고 있습니까? –

+0

Gemfile.lock의 1.3.0 – tipugin

+1

이 부분을 보시려면 https://github.com/railsbp/rails_best_practices/issues/66 –

답변

0

난 정말 모르겠어요하지만 함께하려고 : 버그와 몇 시간 전에이 있었다

class QuestionsController < InheritedResources::Base 
    actions :index, :new, :create, :destroy, :show 
    ... 

: 제외. https://github.com/railsbp/rails_best_practices/issues/66.

InheritedResources gem을 업데이트 해보세요.

+0

고맙습니다. – tipugin