mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Metal controller doesn't have logger method, check it and then delegate
This commit is contained in:
parent
d10eb69964
commit
ccaf982ad8
1 changed files with 8 additions and 2 deletions
|
@ -10,14 +10,20 @@ module ActionView
|
||||||
delegate :request_forgery_protection_token, :params, :session, :cookies, :response, :headers,
|
delegate :request_forgery_protection_token, :params, :session, :cookies, :response, :headers,
|
||||||
:flash, :action_name, :controller_name, :controller_path, :to => :controller
|
:flash, :action_name, :controller_name, :controller_path, :to => :controller
|
||||||
|
|
||||||
delegate :logger, :to => :controller, :allow_nil => true
|
|
||||||
|
|
||||||
def assign_controller(controller)
|
def assign_controller(controller)
|
||||||
if @_controller = controller
|
if @_controller = controller
|
||||||
@_request = controller.request if controller.respond_to?(:request)
|
@_request = controller.request if controller.respond_to?(:request)
|
||||||
@_config = controller.config.inheritable_copy if controller.respond_to?(:config)
|
@_config = controller.config.inheritable_copy if controller.respond_to?(:config)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def logger
|
||||||
|
if controller.respond_to?(:logger)
|
||||||
|
controller.logger
|
||||||
|
else
|
||||||
|
nil
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue