diff options
author | Joshua Peek <josh@joshpeek.com> | 2009-01-13 17:26:29 -0600 |
---|---|---|
committer | Joshua Peek <josh@joshpeek.com> | 2009-01-13 17:26:29 -0600 |
commit | b281a6a5b2137548501ef590379d7af5f6955d2d (patch) | |
tree | f7f8d1c08b5749cbeb5f1d57ed6b97a0824b604e | |
parent | 9775c25824feb35a5c42f3838d21c7e5faba9ca0 (diff) | |
download | rails-b281a6a5b2137548501ef590379d7af5f6955d2d.tar.gz rails-b281a6a5b2137548501ef590379d7af5f6955d2d.tar.bz2 rails-b281a6a5b2137548501ef590379d7af5f6955d2d.zip |
Use Rack's MethodOverride lib [#1699 state:resolved]
-rw-r--r-- | actionpack/lib/action_controller.rb | 1 | ||||
-rw-r--r-- | actionpack/lib/action_controller/middlewares.rb | 2 | ||||
-rw-r--r-- | actionpack/lib/action_controller/verb_piggybacking.rb | 24 | ||||
-rw-r--r-- | railties/lib/initializer.rb | 2 |
4 files changed, 2 insertions, 27 deletions
diff --git a/actionpack/lib/action_controller.rb b/actionpack/lib/action_controller.rb index a9cd09e58d..f808bdd910 100644 --- a/actionpack/lib/action_controller.rb +++ b/actionpack/lib/action_controller.rb @@ -80,7 +80,6 @@ module ActionController autoload :UrlEncodedPairParser, 'action_controller/url_encoded_pair_parser' autoload :UrlRewriter, 'action_controller/url_rewriter' autoload :UrlWriter, 'action_controller/url_rewriter' - autoload :VerbPiggybacking, 'action_controller/verb_piggybacking' autoload :Verification, 'action_controller/verification' module Assertions diff --git a/actionpack/lib/action_controller/middlewares.rb b/actionpack/lib/action_controller/middlewares.rb index 914750bc0c..0f038b8856 100644 --- a/actionpack/lib/action_controller/middlewares.rb +++ b/actionpack/lib/action_controller/middlewares.rb @@ -19,4 +19,4 @@ use "ActiveRecord::QueryCache", :if => lambda { defined?(ActiveRecord) } end use ActionController::RewindableInput -use ActionController::VerbPiggybacking +use Rack::MethodOverride diff --git a/actionpack/lib/action_controller/verb_piggybacking.rb b/actionpack/lib/action_controller/verb_piggybacking.rb deleted file mode 100644 index 86cde304a0..0000000000 --- a/actionpack/lib/action_controller/verb_piggybacking.rb +++ /dev/null @@ -1,24 +0,0 @@ -module ActionController - # TODO: Use Rack::MethodOverride when it is released - class VerbPiggybacking - HTTP_METHODS = %w(GET HEAD PUT POST DELETE OPTIONS) - - def initialize(app) - @app = app - end - - def call(env) - if env["REQUEST_METHOD"] == "POST" - req = Request.new(env) - if method = (req.parameters[:_method] || env["HTTP_X_HTTP_METHOD_OVERRIDE"]) - method = method.to_s.upcase - if HTTP_METHODS.include?(method) - env["REQUEST_METHOD"] = method - end - end - end - - @app.call(env) - end - end -end diff --git a/railties/lib/initializer.rb b/railties/lib/initializer.rb index 619701460d..824d1d6096 100644 --- a/railties/lib/initializer.rb +++ b/railties/lib/initializer.rb @@ -537,7 +537,7 @@ Run `rake gems:install` to install the missing gems. end def initialize_metal - configuration.middleware.insert_before(:"ActionController::VerbPiggybacking", Rails::Rack::Metal) + configuration.middleware.insert_before(:"ActionController::RewindableInput", Rails::Rack::Metal) end # Initializes framework-specific settings for each of the loaded frameworks |