Skip to content

Commit

Permalink
Merge pull request rails#6630 from route/logger_in_metal
Browse files Browse the repository at this point in the history
Metal controller doesn't have logger method, check it and then delegate
  • Loading branch information
josevalim committed Jun 5, 2012
2 parents 2186540 + ccaf982 commit 560b143
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions actionpack/lib/action_view/helpers/controller_helper.rb
Expand Up @@ -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.