自从在 Ruby on Rails 3.1 上使用 Declarative_Authorization 以来,我一直遇到问题。我在每个控制器的顶部添加了这个:
class UsersController < ApplicationController
# Verifies that the user is connected and/or authorized to access the methods
filter_access_to :all, :attribute_check => true
(...)
end
它允许我在我的authorization_rules.rb
:
has_permission_on [:albums], :to => [:adding] do
if_attribute :group => { :user => is { user } }
end
但是当我添加:attribute_check => true
我得到这个错误:
Couldn't find {Model} without an ID
我完全迷路了,我是从这个宝石开始的。