diff options
author | Mehmet Emin İNAÇ <mehmetemininac@gmail.com> | 2015-06-15 23:53:45 +0300 |
---|---|---|
committer | Mehmet Emin İNAÇ <mehmetemininac@gmail.com> | 2015-06-15 23:53:45 +0300 |
commit | cf81a3bae0c8db0d37a48e78179baa9bdd1af3ea (patch) | |
tree | 3087185fe482ea417fbbbe4ef56f534714954b2c /actionpack/lib | |
parent | d3894b992769250f475c9bfac62ac0ecd09397b9 (diff) | |
download | rails-cf81a3bae0c8db0d37a48e78179baa9bdd1af3ea.tar.gz rails-cf81a3bae0c8db0d37a48e78179baa9bdd1af3ea.tar.bz2 rails-cf81a3bae0c8db0d37a48e78179baa9bdd1af3ea.zip |
Deprecate passing hash as first parameter into ActionController::Head
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_controller/metal/head.rb | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/actionpack/lib/action_controller/metal/head.rb b/actionpack/lib/action_controller/metal/head.rb index 70f42bf565..f445094bdc 100644 --- a/actionpack/lib/action_controller/metal/head.rb +++ b/actionpack/lib/action_controller/metal/head.rb @@ -17,8 +17,18 @@ module ActionController # # See Rack::Utils::SYMBOL_TO_STATUS_CODE for a full list of valid +status+ symbols. def head(status, options = {}) - options, status = status, nil if status.is_a?(Hash) - status ||= options.delete(:status) || :ok + if status.is_a?(Hash) + msg = status[:status] ? 'The :status option' : 'The implicit :ok status' + options, status = status, status.delete(:status) + + ActiveSupport::Deprecation.warn(<<-MSG.squish) + #{msg} on `head` has been deprecated and will be removed in Rails 5.1. + Please pass the status as a separate parameter before the options, instead. + MSG + end + + status ||= :ok + location = options.delete(:location) content_type = options.delete(:content_type) |