Permalink
Browse files

Merge pull request #6630 from route/logger_in_metal

Metal controller doesn't have logger method, check it and then delegate
  • Loading branch information...
2 parents 2186540 + ccaf982 commit 560b14303ccf9ad175ffe0e1ce54f52bc88e6d3d @josevalim josevalim committed Jun 5, 2012
Showing with 8 additions and 2 deletions.
  1. +8 −2 actionpack/lib/action_view/helpers/controller_helper.rb
@@ -10,14 +10,20 @@ module ControllerHelper #:nodoc:
delegate :request_forgery_protection_token, :params, :session, :cookies, :response, :headers,
:flash, :action_name, :controller_name, :controller_path, :to => :controller
- delegate :logger, :to => :controller, :allow_nil => true
-
def assign_controller(controller)
if @_controller = controller
@_request = controller.request if controller.respond_to?(:request)
@_config = controller.config.inheritable_copy if controller.respond_to?(:config)
end
end
+
+ def logger
+ if controller.respond_to?(:logger)
+ controller.logger
+ else
+ nil
+ end
+ end
end
end
end

0 comments on commit 560b143

Please sign in to comment.