Railsアプリで宣言型認証を使用しており、次のコントローラーがあります。
class OrganizationsController < ApplicationController
filter_resource_access attribute_check: true
def index
@organizations = Organization.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @organizations }
end
end
end
ただし、そのアクションのビューにアクセス
しようとすると、インスタンス変数undefined method 'each' for nil:NilClass
にアクセスしようとした行でエラーが発生します。@organizations
行をコメントアウトすると機能しfilter_resource_access
ます。
何かご意見は?