Problem with declarative_authorization

#1

Hi there,

I’m using declarative authorization and followed the steps from
Railscasts:

However, when I add filter_resource_access to a controller and reload
the page then I get the error message:

Couldn’t find Customer without an ID

It doesn’t matter what controller I try, all controllers spit out the
same message.

Did anybody have the same problem already and can help me?

If i use filter_access_to :all I get back following error:

Illegal DSL syntax: undefined method `has_permissions_on’ for
#Authorization::Reader::AuthorizationRulesReader:0xb631b134

My application controller looks like this:
class ApplicationController < ActionController::Base
helper :all
protect_from_forgery
filter_parameter_logging :password
helper_method :current_user
before_filter { |c| Authorization.current_user = c.current_user }

def current_user_session
return @current_user_session if defined?(@current_user_session)
@current_user_session = UserSession.find
end

def current_user
return @current_user if defined?(@current_user)
@current_user = current_user_session && current_user_session.record
end

Here a stack trace of the error using filter_resource_access:
/usr/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/base.rb:1601:in
find_from_ids' /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.11/lib/active_record/base.rb:620:infind’
/usr/lib/ruby/gems/1.8/gems/declarative_authorization-0.5.2/lib/declarative_authorization/in_controller.rb:611:in
load_object' /usr/lib/ruby/gems/1.8/gems/declarative_authorization-0.5.2/lib/declarative_authorization/in_controller.rb:583:inpermit!’
/usr/lib/ruby/gems/1.8/gems/declarative_authorization-0.5.2/lib/declarative_authorization/in_controller.rb:111:in
filter_access_filter' /usr/lib/ruby/gems/1.8/gems/authlogic-2.1.6/lib/authlogic/session/password.rb:127:inall?’
/usr/lib/ruby/gems/1.8/gems/declarative_authorization-0.5.2/lib/declarative_authorization/in_controller.rb:111:in
each' /usr/lib/ruby/gems/1.8/gems/declarative_authorization-0.5.2/lib/declarative_authorization/in_controller.rb:111:inall?’
/usr/lib/ruby/gems/1.8/gems/declarative_authorization-0.5.2/lib/declarative_authorization/in_controller.rb:111:in
filter_access_filter' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/callbacks.rb:178:insend’
/usr/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/callbacks.rb:178:in
evaluate_method' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/callbacks.rb:166:incall’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/filters.rb:225:in
call' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/filters.rb:629:inrun_before_filters’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/filters.rb:615:in
call_filters' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/filters.rb:610:inperform_action_without_benchmark’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/benchmarking.rb:68:in
perform_action_without_rescue' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/core_ext/benchmark.rb:17:inms’
/usr/lib/ruby/1.8/benchmark.rb:308:in realtime' /usr/lib/ruby/gems/1.8/gems/activesupport-2.3.11/lib/active_support/core_ext/benchmark.rb:17:inms’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/benchmarking.rb:68:in
perform_action_without_rescue' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/rescue.rb:160:inperform_action_without_flash’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/flash.rb:151:in
perform_action' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/base.rb:532:insend’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/base.rb:532:in
process_without_filters' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/filters.rb:606:inprocess’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/base.rb:391:in
process' /usr/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/base.rb:386:incall’
/usr/lib/ruby/gems/1.8/gems/actionpack-2.3.11/lib/action_controller/routing/route_set.rb:438:in
`call’