diff options
author | Rafael França <rafaelmfranca@gmail.com> | 2017-07-24 13:33:17 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-24 13:33:17 -0400 |
commit | 6f0729b604dca46d4198f74a08eb836b2e8b5492 (patch) | |
tree | ef4cf794d97004099d51a0fca92f274686a10904 /actionview/lib | |
parent | dd58cc2ebb9cc0f4f4db50a1a6d3296ad9a6a8e2 (diff) | |
parent | 3cb7fe590f2b3cf29c2a32504fb4d24a79559a0b (diff) | |
download | rails-6f0729b604dca46d4198f74a08eb836b2e8b5492.tar.gz rails-6f0729b604dca46d4198f74a08eb836b2e8b5492.tar.bz2 rails-6f0729b604dca46d4198f74a08eb836b2e8b5492.zip |
Merge pull request #29792 from lugray/delegate_respond_to
Delegate respond_to? in ActionView::Helpers::ControllerHelper
Diffstat (limited to 'actionview/lib')
-rw-r--r-- | actionview/lib/action_view/helpers/controller_helper.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/actionview/lib/action_view/helpers/controller_helper.rb b/actionview/lib/action_view/helpers/controller_helper.rb index e86cdca4e4..65854e317f 100644 --- a/actionview/lib/action_view/helpers/controller_helper.rb +++ b/actionview/lib/action_view/helpers/controller_helper.rb @@ -7,8 +7,11 @@ module ActionView module ControllerHelper #:nodoc: attr_internal :controller, :request - delegate :request_forgery_protection_token, :params, :session, :cookies, :response, :headers, - :flash, :action_name, :controller_name, :controller_path, to: :controller + CONTROLLER_DELEGATES = [:request_forgery_protection_token, :params, + :session, :cookies, :response, :headers, :flash, :action_name, + :controller_name, :controller_path] + + delegate *CONTROLLER_DELEGATES, to: :controller def assign_controller(controller) if @_controller = controller @@ -21,6 +24,11 @@ module ActionView def logger controller.logger if controller.respond_to?(:logger) end + + def respond_to?(method_name, include_private = false) + return controller.respond_to?(method_name) if CONTROLLER_DELEGATES.include?(method_name.to_sym) + super + end end end end |