diff options
Diffstat (limited to 'actionpack/lib/action_controller')
4 files changed, 25 insertions, 13 deletions
diff --git a/actionpack/lib/action_controller/api.rb b/actionpack/lib/action_controller/api.rb index d8149e0232..3af63b8892 100644 --- a/actionpack/lib/action_controller/api.rb +++ b/actionpack/lib/action_controller/api.rb @@ -4,7 +4,7 @@ require 'action_controller/log_subscriber' module ActionController # API Controller is a lightweight version of <tt>ActionController::Base</tt>, - # created for applications that don't require all functionality that a complete + # created for applications that don't require all functionalities that a complete # \Rails controller provides, allowing you to create controllers with just the # features that you need for API only applications. # @@ -61,10 +61,10 @@ module ActionController # In some scenarios you may want to add back some functionality provided by # <tt>ActionController::Base</tt> that is not present by default in # <tt>ActionController::API</tt>, for instance <tt>MimeResponds</tt>. This - # module gives you the <tt>respond_to</tt> and <tt>respond_with</tt> methods. - # Adding it is quite simple, you just need to include the module in a specific - # controller or in <tt>ApplicationController</tt> in case you want it - # available to your entire app: + # module gives you the <tt>respond_to</tt> method. Adding it is quite simple, + # you just need to include the module in a specific controller or in + # +ApplicationController+ in case you want it available in your entire + # application: # # class ApplicationController < ActionController::API # include ActionController::MimeResponds @@ -87,16 +87,18 @@ module ActionController class API < Metal abstract! - # Shortcut helper that returns all the ActionController::API modules except the ones passed in the argument: + # Shortcut helper that returns all the ActionController::API modules except + # the ones passed as arguments: # # class MetalController - # ActionController::API.without_modules(:Redirecting, :DataStreaming).each do |left| + # ActionController::API.without_modules(:ForceSSL, :UrlFor).each do |left| # include left # end # end # # This gives better control over what you want to exclude and makes it easier - # to create an api controller class, instead of listing the modules required manually. + # to create an API controller class, instead of listing the modules required + # manually. def self.without_modules(*modules) modules = modules.map do |m| m.is_a?(Symbol) ? ActionController.const_get(m) : m @@ -120,7 +122,7 @@ module ActionController ForceSSL, DataStreaming, - # Before callbacks should also be executed the earliest as possible, so + # Before callbacks should also be executed as early as possible, so # also include them at the bottom. AbstractController::Callbacks, 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) diff --git a/actionpack/lib/action_controller/metal/http_authentication.rb b/actionpack/lib/action_controller/metal/http_authentication.rb index fb0a52b076..39bed955a4 100644 --- a/actionpack/lib/action_controller/metal/http_authentication.rb +++ b/actionpack/lib/action_controller/metal/http_authentication.rb @@ -493,7 +493,7 @@ module ActionController "Token #{values * ", "}" end - # Sets a WWW-Authenticate to let the client know a token is desired. + # Sets a WWW-Authenticate header to let the client know a token is desired. # # controller - ActionController::Base instance for the outgoing response. # realm - String realm to use in the header. diff --git a/actionpack/lib/action_controller/metal/params_wrapper.rb b/actionpack/lib/action_controller/metal/params_wrapper.rb index 8a4ea70649..cdfc523bd4 100644 --- a/actionpack/lib/action_controller/metal/params_wrapper.rb +++ b/actionpack/lib/action_controller/metal/params_wrapper.rb @@ -40,7 +40,7 @@ module ActionController # wrap_parameters :person, include: [:username, :password] # end # - # On ActiveRecord models with no +:include+ or +:exclude+ option set, + # On Active Record models with no +:include+ or +:exclude+ option set, # it will only wrap the parameters returned by the class method # <tt>attribute_names</tt>. # |