Ruby on rails 3.1 で declarative_authorization を使用しています。
グループには多くのアルバム (groupalbum) があり、グループは 1 人のユーザーによって作成されます (グループ テーブルの外部キーの user_id)。グループの所有者だけがアルバムを作成できます。
ここに私の authorization_rules.rb があります:
has_permission_on [:group_albums], :to => [:create] do
if_attribute :group => { :user => is_in { user.groups } }
end
ここに私の GroupAlbumsControler があります:
class GroupAlbumsController < ApplicationController
before_filter :set_group_album_from_params, :only => :show
before_filter :set_group_album_new, :only => [:index, :new]
filter_access_to :all, :attribute_check => true
(...)
end
しかし、うまくいきません:
You are not allowed to access this action.
グループの所有者でログインしている場合でも。
私の間違いはどこですか?