diff options
-rw-r--r-- | actionpack/lib/action_controller/metal/params_wrapper.rb | 2 | ||||
-rw-r--r-- | railties/test/application/configuration_test.rb | 30 |
2 files changed, 28 insertions, 4 deletions
diff --git a/actionpack/lib/action_controller/metal/params_wrapper.rb b/actionpack/lib/action_controller/metal/params_wrapper.rb index 21bbe17dc3..881af74147 100644 --- a/actionpack/lib/action_controller/metal/params_wrapper.rb +++ b/actionpack/lib/action_controller/metal/params_wrapper.rb @@ -125,7 +125,7 @@ module ActionController # module is inherited. def inherited(klass) if klass._wrapper_options[:format].present? - klass._set_wrapper_defaults(klass._wrapper_options) + klass._set_wrapper_defaults(klass._wrapper_options.slice(:format)) end super end diff --git a/railties/test/application/configuration_test.rb b/railties/test/application/configuration_test.rb index b1f7076776..6193e72625 100644 --- a/railties/test/application/configuration_test.rb +++ b/railties/test/application/configuration_test.rb @@ -12,7 +12,6 @@ end class ::MyOtherMailObserver < ::MyMailObserver; end - module ApplicationTests class ConfigurationTest < Test::Unit::TestCase include ActiveSupport::Testing::Isolation @@ -437,10 +436,35 @@ module ApplicationTests app_file 'config/initializers/wrap_parameters.rb', <<-RUBY ActionController::Base.wrap_parameters :format => [:json] RUBY + + app_file 'app/models/post.rb', <<-RUBY + class Post + def self.column_names + %w(title) + end + end + RUBY + + app_file 'app/controllers/posts_controller.rb', <<-RUBY + class PostsController < ApplicationController + def index + render :text => params[:post].inspect + end + end + RUBY + + add_to_config <<-RUBY + routes.append do + resources :posts + end + RUBY + require "#{app_path}/config/environment" - require 'action_controller/base' + require "rack/test" + extend Rack::Test::Methods - assert_equal [:json], ActionController::Base._wrapper_options[:format] + post "/posts.json", '{ "title": "foo", "name": "bar" }', "CONTENT_TYPE" => "application/json" + assert_equal '{"title"=>"foo"}', last_response.body end test "config.action_dispatch.ignore_accept_header" do |