diff options
author | wycats <wycats@gmail.com> | 2010-04-10 17:22:52 -0400 |
---|---|---|
committer | wycats <wycats@gmail.com> | 2010-04-10 17:22:52 -0400 |
commit | 87f7093ee3306f417e1136d947eba200d40ff8e7 (patch) | |
tree | ba70dbdaf67e12fc067bb5d8343d7681932452ef /actionpack/lib/action_dispatch | |
parent | ee8e9d548472fb8cb8792a569e579c6513be77d6 (diff) | |
parent | 381f877bbbbf81d679f5be3b7ac7e961d41502bd (diff) | |
download | rails-87f7093ee3306f417e1136d947eba200d40ff8e7.tar.gz rails-87f7093ee3306f417e1136d947eba200d40ff8e7.tar.bz2 rails-87f7093ee3306f417e1136d947eba200d40ff8e7.zip |
Merge branch 'master' into docrails_master
Diffstat (limited to 'actionpack/lib/action_dispatch')
3 files changed, 19 insertions, 19 deletions
diff --git a/actionpack/lib/action_dispatch/middleware/params_parser.rb b/actionpack/lib/action_dispatch/middleware/params_parser.rb index 18a3688bb0..1524b00d5b 100644 --- a/actionpack/lib/action_dispatch/middleware/params_parser.rb +++ b/actionpack/lib/action_dispatch/middleware/params_parser.rb @@ -36,17 +36,16 @@ module ActionDispatch when Proc strategy.call(request.raw_post) when :xml_simple, :xml_node - request.body.size == 0 ? {} : Hash.from_xml(request.raw_post).with_indifferent_access + data = Hash.from_xml(request.body) || {} + request.body.rewind if request.body.respond_to?(:rewind) + data.with_indifferent_access when :yaml YAML.load(request.raw_post) when :json - if request.body.size == 0 - {} - else - data = ActiveSupport::JSON.decode(request.raw_post) - data = {:_json => data} unless data.is_a?(Hash) - data.with_indifferent_access - end + data = ActiveSupport::JSON.decode(request.body) + request.body.rewind if request.body.respond_to?(:rewind) + data = {:_json => data} unless data.is_a?(Hash) + data.with_indifferent_access else false end @@ -76,4 +75,4 @@ module ActionDispatch defined?(Rails.logger) ? Rails.logger : Logger.new($stderr) end end -end
\ No newline at end of file +end diff --git a/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb b/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb index 839df50999..09ff052fd0 100644 --- a/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb +++ b/actionpack/lib/action_dispatch/middleware/templates/rescues/_request_and_response.erb @@ -6,7 +6,7 @@ <% end %> <% - clean_params = @request.parameters.clone + clean_params = @request.filtered_parameters.clone clean_params.delete("action") clean_params.delete("controller") diff --git a/actionpack/lib/action_dispatch/routing/mapper.rb b/actionpack/lib/action_dispatch/routing/mapper.rb index 925e91f081..7035e360ec 100644 --- a/actionpack/lib/action_dispatch/routing/mapper.rb +++ b/actionpack/lib/action_dispatch/routing/mapper.rb @@ -324,7 +324,8 @@ module ActionDispatch end def namespace(path) - scope(path.to_s, :name_prefix => path.to_s, :controller_namespace => path.to_s) { yield } + path = path.to_s + scope(:path => path, :name_prefix => path, :module => path) { yield } end def constraints(constraints = {}) @@ -363,15 +364,15 @@ module ActionDispatch parent ? "#{parent}_#{child}" : child end - def merge_controller_namespace_scope(parent, child) + def merge_module_scope(parent, child) parent ? "#{parent}/#{child}" : child end def merge_controller_scope(parent, child) - @scope[:controller_namespace] ? "#{@scope[:controller_namespace]}/#{child}" : child + @scope[:module] ? "#{@scope[:module]}/#{child}" : child end - def merge_resources_path_names_scope(parent, child) + def merge_path_names_scope(parent, child) merge_options_scope(parent, child) end @@ -520,7 +521,7 @@ module ActionDispatch def initialize(*args) #:nodoc: super - @scope[:resources_path_names] = @set.resources_path_names + @scope[:path_names] = @set.resources_path_names end def resource(*resources, &block) @@ -636,7 +637,7 @@ module ActionDispatch return self end - resources_path_names = options.delete(:path_names) + path_names = options.delete(:path_names) if args.first.is_a?(Symbol) action = args.first @@ -653,7 +654,7 @@ module ActionDispatch end else with_exclusive_name_prefix(action) do - return match("#{action_path(action, resources_path_names)}(.:format)", options.reverse_merge(:to => action)) + return match("#{action_path(action, path_names)}(.:format)", options.reverse_merge(:to => action)) end end end @@ -681,7 +682,7 @@ module ActionDispatch private def action_path(name, path_names = nil) - path_names ||= @scope[:resources_path_names] + path_names ||= @scope[:path_names] path_names[name.to_sym] || name.to_s end @@ -692,7 +693,7 @@ module ActionDispatch end if path_names = options.delete(:path_names) - scope(:resources_path_names => path_names) do + scope(:path_names => path_names) do send(method, resources.pop, options, &block) end return true |