show
この宝石を使用するのは初めてで、リソース所有者のみにアクションを許可するのと同じくらい簡単なことに夢中になっています。
コントローラーのマッピングとアクションを構成するさまざまな方法を試しましたが、常に の不正なメッセージが表示されshow
、他のアクションは正常に機能します。
show
ApplicationAuthorizer に到達していないようです。
構成方法は次のとおりです。
class EnterpriseAuthorizer < ApplicationAuthorizer
# This works
def self.creatable_by?(user)
user.is_enterpriser?
end
# This doesn't
def readable_by?(user)
true # Just for testing
end
end
class EnterprisesController < ApplicationController
authorize_actions_for Enterprise
def show
@enterprise = Enterprise.find(params[:id])
respond_to do |format|
format.html
format.json { render json: @enterprise }
end
end
私はinclude Authority::UserAbilities
ユーザーモデルとinclude Authority::Abilities
エンタープライズモデルを持っています。そしてユーザーhas_one :enterprise
何か案が?cancanへのロールバックを真剣に考えています。
前もって感謝します。