Permalink
Browse files

Merge pull request #151 from jhawthorn/class_nil_in_19

under ruby 1.9.2, .name returns nil for anonymous classes
  • Loading branch information...
2 parents 0d0015b + c383b75 commit e9e1aff533aa2c6315b0a34aa64d2618ff636196 @stffn committed Sep 23, 2012
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/declarative_authorization/maintenance.rb
@@ -60,9 +60,10 @@ def self.usages_by_controller
end
rescue Errno::ENOENT
end
- controllers = []
- ObjectSpace.each_object(Class) do |obj|
- controllers << obj if obj.ancestors.include?(ActionController::Base) and obj != ActionController::Base and obj.name.demodulize != 'ApplicationController'
+ controllers = ObjectSpace.each_object(Class).select do |obj|
+ obj.ancestors.include?(ActionController::Base) &&
+ obj != ActionController::Base &&
+ (!obj.name || obj.name.demodulize != 'ApplicationController')
end
controllers.inject({}) do |memo, controller|

0 comments on commit e9e1aff

Please sign in to comment.