0

私のモデルは次のように設定されています

Film :has_many :sections

Section :belongs_to :film

私のauthorization_rules.rb内に私は持っています

role :author do
    has_permission_on :films, :to => [:edit. :update] do
      if_attribute :user => is {user}
    end
end

フィルム内の user_id フィールドであるため、フィルムを編集するときにうまく機能します。

has-permission-on do ブロック内で :sections のルールをネストできますか? セクション内に user_id はありません。セクションがすでに 1 つある映画に属している場合、冗長に思えるので追加したくありません。

4

1 に答える 1