mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
minor edits after going through what's new in docrails
This commit is contained in:
parent
47003f8cdf
commit
e5524d538c
3 changed files with 13 additions and 10 deletions
|
@ -1,9 +1,9 @@
|
||||||
# Includes #url_for into the host class (e.g. an abstract controller or mailer). The class
|
# Includes +url_for+ into the host class (e.g. an abstract controller or mailer). The class
|
||||||
# has to provide a RouteSet by implementing the #_routes methods. Otherwise, an exception
|
# has to provide a +RouteSet+ by implementing the <tt>_routes</tt> methods. Otherwise, an
|
||||||
# will be raised.
|
# exception will be raised.
|
||||||
#
|
#
|
||||||
# Note that this module is completely decoupled from HTTP - the only requirement is a valid
|
# Note that this module is completely decoupled from HTTP - the only requirement is a valid
|
||||||
# #_routes implementation.
|
# <tt>_routes</tt> implementation.
|
||||||
module AbstractController
|
module AbstractController
|
||||||
module UrlFor
|
module UrlFor
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
|
@ -1,21 +1,24 @@
|
||||||
# Includes #url_for into the host class. The class has to provide a RouteSet by implementing
|
# Includes +url_for+ into the host class. The class has to provide a +RouteSet+ by implementing
|
||||||
# the #_routes methods. Otherwise, an exception will be raised.
|
# the <tt>_routes</tt> method. Otherwise, an exception will be raised.
|
||||||
#
|
#
|
||||||
# In addition to AbstractController::UrlFor, this module accesses the HTTP layer to define
|
# In addition to <tt>AbstractController::UrlFor</tt>, this module accesses the HTTP layer to define
|
||||||
# url options like the +host+. In order to do so, this module requires the host class
|
# url options like the +host+. In order to do so, this module requires the host class
|
||||||
# to implement #env and #request, which need to be a Rack-compatible.
|
# to implement +env+ and +request+, which need to be a Rack-compatible.
|
||||||
#
|
#
|
||||||
# Example:
|
# Example:
|
||||||
#
|
#
|
||||||
# class RootUrl
|
# class RootUrl
|
||||||
# include ActionController::UrlFor
|
# include ActionController::UrlFor
|
||||||
# include Rails.application.routes.url_helpers
|
# include Rails.application.routes.url_helpers
|
||||||
|
#
|
||||||
# delegate :env, :request, :to => :controller
|
# delegate :env, :request, :to => :controller
|
||||||
#
|
#
|
||||||
# def initialize(controller)
|
# def initialize(controller)
|
||||||
# @controller = controller
|
# @controller = controller
|
||||||
# @url = root_path # named route from the application.
|
# @url = root_path # named route from the application.
|
||||||
# end
|
# end
|
||||||
|
# end
|
||||||
|
# =>
|
||||||
module ActionController
|
module ActionController
|
||||||
module UrlFor
|
module UrlFor
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
|
@ -352,7 +352,7 @@ module ActionDispatch
|
||||||
#
|
#
|
||||||
# [:constraints]
|
# [:constraints]
|
||||||
# Constrains parameters with a hash of regular expressions or an
|
# Constrains parameters with a hash of regular expressions or an
|
||||||
# object that responds to <tt>#matches?</tt>
|
# object that responds to <tt>matches?</tt>
|
||||||
#
|
#
|
||||||
# match 'path/:id', :constraints => { :id => /[A-Z]\d{5}/ }
|
# match 'path/:id', :constraints => { :id => /[A-Z]\d{5}/ }
|
||||||
#
|
#
|
||||||
|
@ -373,7 +373,7 @@ module ActionDispatch
|
||||||
# See <tt>Scoping#defaults</tt> for its scope equivalent.
|
# See <tt>Scoping#defaults</tt> for its scope equivalent.
|
||||||
#
|
#
|
||||||
# [:anchor]
|
# [:anchor]
|
||||||
# Boolean to anchor a <tt>#match</tt> pattern. Default is true. When set to
|
# Boolean to anchor a <tt>match</tt> pattern. Default is true. When set to
|
||||||
# false, the pattern matches any request prefixed with the given path.
|
# false, the pattern matches any request prefixed with the given path.
|
||||||
#
|
#
|
||||||
# # Matches any request starting with 'path'
|
# # Matches any request starting with 'path'
|
||||||
|
|
Loading…
Reference in a new issue