lib/authority/abilities.rb in authority-0.2.0 vs lib/authority/abilities.rb in authority-0.3.0
- old
+ new
@@ -19,10 +19,18 @@
end
RUBY
end
def authorizer
- @authorizer ||= authorizer_name.constantize
+ begin
+ @authorizer ||= authorizer_name.constantize
+ rescue StandardError => e
+ if e.is_a?(NameError)
+ raise Authority::NoAuthorizerError.new("#{authorizer_name} does not exist in your application")
+ else
+ raise e
+ end
+ end
end
end
Authority.adjectives.each do |adjective|