1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

A few documentation edits [ci skip]

This commit is contained in:
Robin Dupret 2015-06-15 13:27:38 +02:00
parent ce882b17f4
commit a023d5391e
3 changed files with 14 additions and 12 deletions

View file

@ -4,7 +4,7 @@ require 'action_controller/log_subscriber'
module ActionController module ActionController
# API Controller is a lightweight version of <tt>ActionController::Base</tt>, # 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 # \Rails controller provides, allowing you to create controllers with just the
# features that you need for API only applications. # 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 # 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::Base</tt> that is not present by default in
# <tt>ActionController::API</tt>, for instance <tt>MimeResponds</tt>. This # <tt>ActionController::API</tt>, for instance <tt>MimeResponds</tt>. This
# module gives you the <tt>respond_to</tt> and <tt>respond_with</tt> methods. # module gives you the <tt>respond_to</tt> method. Adding it is quite simple,
# Adding it is quite simple, you just need to include the module in a specific # you just need to include the module in a specific controller or in
# controller or in <tt>ApplicationController</tt> in case you want it # +ApplicationController+ in case you want it available in your entire
# available to your entire app: # application:
# #
# class ApplicationController < ActionController::API # class ApplicationController < ActionController::API
# include ActionController::MimeResponds # include ActionController::MimeResponds
@ -87,16 +87,18 @@ module ActionController
class API < Metal class API < Metal
abstract! 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 # class MetalController
# ActionController::API.without_modules(:Redirecting, :DataStreaming).each do |left| # ActionController::API.without_modules(:ForceSSL, :UrlFor).each do |left|
# include left # include left
# end # end
# end # end
# #
# This gives better control over what you want to exclude and makes it easier # 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) def self.without_modules(*modules)
modules = modules.map do |m| modules = modules.map do |m|
m.is_a?(Symbol) ? ActionController.const_get(m) : m m.is_a?(Symbol) ? ActionController.const_get(m) : m
@ -120,7 +122,7 @@ module ActionController
ForceSSL, ForceSSL,
DataStreaming, 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. # also include them at the bottom.
AbstractController::Callbacks, AbstractController::Callbacks,

View file

@ -40,7 +40,7 @@ module ActionController
# wrap_parameters :person, include: [:username, :password] # wrap_parameters :person, include: [:username, :password]
# end # 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 # it will only wrap the parameters returned by the class method
# <tt>attribute_names</tt>. # <tt>attribute_names</tt>.
# #

View file

@ -75,8 +75,8 @@ module ActiveRecord
# #
# Conversation.where("status <> ?", Conversation.statuses[:archived]) # Conversation.where("status <> ?", Conversation.statuses[:archived])
# #
# You can use <tt>:enum_prefix</tt>/<tt>:enum_suffix</tt> option then you need # You can use the +:enum_prefix+ or +:enum_suffix+ options when you need
# to define multiple enums with same values. If option value is <tt>true</tt>, # to define multiple enums with same values. If the passed value is +true+,
# the methods are prefixed/suffixed with the name of the enum. # the methods are prefixed/suffixed with the name of the enum.
# #
# class Invoice < ActiveRecord::Base # class Invoice < ActiveRecord::Base