CanCanは、InheritedResoucesを使用している間、コントローラのインデックスアクションで実際に異常な動作をします。私は ability.rbにInheritedResources/CanCan issue
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 –