diff options
author | Yves Senn <yves.senn@gmail.com> | 2014-05-20 08:21:32 +0200 |
---|---|---|
committer | Yves Senn <yves.senn@gmail.com> | 2014-05-20 08:21:32 +0200 |
commit | 00d1b132c0194b3a9b495ad43ba0c1198755b548 (patch) | |
tree | 07fc536d88101de855f7dcf5451790fa6e7f39a4 /actionpack/lib | |
parent | fe06e9ac2358654d2bc875775140807eb5406def (diff) | |
parent | ac36b45672513417d59ab8960b49ff1f8707d352 (diff) | |
download | rails-00d1b132c0194b3a9b495ad43ba0c1198755b548.tar.gz rails-00d1b132c0194b3a9b495ad43ba0c1198755b548.tar.bz2 rails-00d1b132c0194b3a9b495ad43ba0c1198755b548.zip |
Merge pull request #15178 from zuhao/refactor_actionpack_respond_with_test
Deregister csv renderer after test to prevent leak.
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/metal/renderers.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/actionpack/lib/action_controller/metal/renderers.rb b/actionpack/lib/action_controller/metal/renderers.rb index 0443b73953..29ce5abd55 100644 --- a/actionpack/lib/action_controller/metal/renderers.rb +++ b/actionpack/lib/action_controller/metal/renderers.rb @@ -6,6 +6,11 @@ module ActionController Renderers.add(key, &block) end + # See <tt>Renderers.remove</tt> + def self.remove_renderer(key) + Renderers.remove(key) + end + class MissingRenderer < LoadError def initialize(format) super "No renderer defined for format: #{format}" @@ -83,6 +88,17 @@ module ActionController RENDERERS << key.to_sym end + # This method is the opposite of add method. + # + # Usage: + # + # ActionController::Renderers.remove(:csv) + def self.remove(key) + RENDERERS.delete(key.to_sym) + method = "_render_option_#{key}" + remove_method(method) if method_defined?(method) + end + module All extend ActiveSupport::Concern include Renderers |