diff options
Diffstat (limited to 'actionpack/lib/action_dispatch')
-rw-r--r-- | actionpack/lib/action_dispatch/http/request.rb | 3 | ||||
-rw-r--r-- | actionpack/lib/action_dispatch/middleware/public_exceptions.rb | 7 |
2 files changed, 4 insertions, 6 deletions
diff --git a/actionpack/lib/action_dispatch/http/request.rb b/actionpack/lib/action_dispatch/http/request.rb index 6757a53bd1..8cea17c7a6 100644 --- a/actionpack/lib/action_dispatch/http/request.rb +++ b/actionpack/lib/action_dispatch/http/request.rb @@ -271,13 +271,12 @@ module ActionDispatch case v when Array v.grep(Hash) { |x| deep_munge(x) } + v.compact! when Hash deep_munge(v) end end - keys = hash.keys.find_all { |k| hash[k] == [nil] } - keys.each { |k| hash[k] = nil } hash end diff --git a/actionpack/lib/action_dispatch/middleware/public_exceptions.rb b/actionpack/lib/action_dispatch/middleware/public_exceptions.rb index bf9149ebf2..204f3f7fb3 100644 --- a/actionpack/lib/action_dispatch/middleware/public_exceptions.rb +++ b/actionpack/lib/action_dispatch/middleware/public_exceptions.rb @@ -3,9 +3,8 @@ module ActionDispatch class PublicExceptions attr_accessor :public_path - def initialize(public_path, consider_all_requests_local = false) + def initialize(public_path) @public_path = public_path - @consider_all_requests_local = consider_all_requests_local end def call(env) @@ -13,7 +12,7 @@ module ActionDispatch status = env["PATH_INFO"][1..-1] request = ActionDispatch::Request.new(env) content_type = request.formats.first - format = (mime = Mime[content_type]) && "to_#{mime.to_sym}" + format = content_type && "to_#{content_type.to_sym}" body = { :status => status, :error => exception.message } render(status, body, :format => format, :content_type => content_type) @@ -24,7 +23,7 @@ module ActionDispatch def render(status, body, options) format = options[:format] - if !@consider_all_requests_local && format && body.respond_to?(format) + if format && body.respond_to?(format) render_format(status, body.public_send(format), options) else render_html(status) |