Permalink
Browse files

Merge docrails:

commit e6afd8b
Author: Xavier Noria <fxn@hashref.com>
Date:   Thu May 8 23:49:36 2008 +0200

    Overall documentation improvement and markup corrections. Zillion changes.

commit 2fead68
Author: Austin Putman <austin@emmanuel.local>
Date:   Wed May 7 19:35:46 2008 -0700

    Documented class methods on ActionController::Routing.  These are dangerous, and mostly used for testing.

commit f5b8418
Author: Teflon Ted <github@rudiment.net>
Date:   Wed May 7 16:08:49 2008 -0400

    Added explanation about errant inflections not being patched in the future in order to avoid breaking legacy applications.

commit 370f4f5
Author: Sunny Ripert <negatif@gmail.com>
Date:   Wed May 7 14:00:59 2008 +0200

    Applied list conventions in AR::Base

commit 5bd1842
Author: Sunny Ripert <negatif@gmail.com>
Date:   Wed May 7 13:53:35 2008 +0200

    Renamed Options list to Attributes list whenever they weren't option hashes in AR::Base

commit d912bd5
Author: Yaroslav Markin <yaroslav@markin.net>
Date:   Wed May 7 13:50:28 2008 +0400

    Add a filter_parameter_logging usage hint to generated ApplicationController.
    This may help to remind the developer to filter sensitive information from application logs.
    Closes #11578

commit b243de0
Author: Jack Danger Canty <git@6brand.com>
Date:   Tue May 6 23:39:47 2008 -0700

    doc: disambiguating an example ActiveRecord class

commit f81d771
Author: Jack Danger Canty <git@6brand.com>
Date:   Tue May 6 23:35:05 2008 -0700

    doc: ActiveRecord::Reflection::AssociationReflection#through_reflection

    Added documentation demonstrating the use of #through_reflection for
    finding intervening reflection objects for HasManyThrough
    and HasOneThrough.

commit ae6b46f
Author: Cheah Chu Yeow <chuyeow@gmail.com>
Date:   Wed May 7 13:47:41 2008 +0800

    Document AttributeAssignmentError and MultiparameterAssignmentErrors.

commit 8f46355
Author: John Barnette <jbarnette@gmail.com>
Date:   Tue May 6 22:46:44 2008 -0700

    Killing/fixing a bunch of outdated language in the AR README.

commit aca44bc
Author: Cheah Chu Yeow <chuyeow@gmail.com>
Date:   Wed May 7 13:34:52 2008 +0800

    Make a note about ActiveResource::Timeouterror being raised when ARes calls timeout.

commit 284a930
Author: Jonathan Dance <jd@wuputah.com>
Date:   Tue May 6 14:58:26 2008 -0400

    improvements to the page caching docs

commit 9482da6
Author: Sunny Ripert <negatif@gmail.com>
Date:   Mon May 5 18:13:40 2008 +0200

    validates_numericality_of() "integer" option really is "only_integer"

commit e9afd67
Author: Sunny Ripert <negatif@gmail.com>
Date:   Mon May 5 12:11:59 2008 +0200

    Harmonized hash notation in AR::Base

commit 67ebf14
Author: Sunny Ripert <negatif@gmail.com>
Date:   Mon May 5 12:06:19 2008 +0200

    Turned options into rdoc-lists in AR::Base

commit 0ec7c0a
Author: Marshall Huss <mwhuss@Macbook.local>
Date:   Sun May 4 23:21:33 2008 -0400

    Added information of how to set element_name in the case the user has a name confliction with an existing model

Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
  • Loading branch information...
1 parent bfbf03e commit dc4eec1129520ce9863c9373d7cb79d8636ab7ca @lifo lifo committed May 9, 2008
Showing with 658 additions and 570 deletions.
  1. +13 −12 actionmailer/lib/action_mailer/base.rb
  2. +13 −13 actionpack/lib/action_controller/assertions/selector_assertions.rb
  3. +29 −23 actionpack/lib/action_controller/base.rb
  4. +2 −1 actionpack/lib/action_controller/caching.rb
  5. +18 −13 actionpack/lib/action_controller/caching/pages.rb
  6. +10 −8 actionpack/lib/action_controller/polymorphic_routes.rb
  7. +2 −2 actionpack/lib/action_controller/request_forgery_protection.rb
  8. +17 −17 actionpack/lib/action_controller/resources.rb
  9. +31 −4 actionpack/lib/action_controller/routing.rb
  10. +13 −8 actionpack/lib/action_controller/session/active_record_store.rb
  11. +7 −7 actionpack/lib/action_controller/url_rewriter.rb
  12. +12 −12 actionpack/lib/action_view/base.rb
  13. +3 −3 actionpack/lib/action_view/helpers/form_tag_helper.rb
  14. +36 −6 actionpack/lib/action_view/helpers/prototype_helper.rb
  15. +14 −14 actionpack/lib/action_view/helpers/url_helper.rb
  16. +1 −1 activemodel/lib/active_model/validations/associated.rb
  17. +11 −11 activemodel/lib/active_model/validations/numericality.rb
  18. +7 −17 activerecord/README
  19. +138 −137 activerecord/lib/active_record/associations.rb
  20. +86 −69 activerecord/lib/active_record/base.rb
  21. +6 −0 activerecord/lib/active_record/connection_adapters/abstract/query_cache.rb
  22. +2 −2 activerecord/lib/active_record/connection_adapters/abstract_adapter.rb
  23. +12 −12 activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
  24. +9 −9 activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
  25. +1 −1 activerecord/lib/active_record/connection_adapters/sqlite_adapter.rb
  26. +1 −1 activerecord/lib/active_record/fixtures.rb
  27. +13 −1 activerecord/lib/active_record/reflection.rb
  28. +4 −4 activerecord/lib/active_record/validations.rb
  29. +103 −129 activeresource/lib/active_resource/base.rb
  30. +21 −22 activesupport/lib/active_support/core_ext/hash/indifferent_access.rb
  31. +5 −0 activesupport/lib/active_support/inflector.rb
  32. +5 −0 railties/helpers/application.rb
  33. +5 −3 railties/lib/initializer.rb
  34. +8 −8 railties/lib/rails/plugin.rb
@@ -95,7 +95,7 @@ module ActionMailer #:nodoc:
#
# ActionMailer::Base.default_url_options[:host] = "example.com"
#
- # This can also be set as a configuration option in <tt>environment.rb</tt>:
+ # This can also be set as a configuration option in <tt>config/environment.rb</tt>:
#
# config.action_mailer.default_url_options = { :host => "example.com" }
#
@@ -204,22 +204,23 @@ module ActionMailer #:nodoc:
# Can be set to nil for no logging. Compatible with both Ruby's own Logger and Log4r loggers.
#
# * <tt>smtp_settings</tt> - Allows detailed configuration for <tt>:smtp</tt> delivery method:
- # * <tt>:address</tt> Allows you to use a remote mail server. Just change it from its default "localhost" setting.
- # * <tt>:port</tt> On the off chance that your mail server doesn't run on port 25, you can change it.
- # * <tt>:domain</tt> If you need to specify a HELO domain, you can do it here.
- # * <tt>:user_name</tt> If your mail server requires authentication, set the username in this setting.
- # * <tt>:password</tt> If your mail server requires authentication, set the password in this setting.
- # * <tt>:authentication</tt> If your mail server requires authentication, you need to specify the authentication type here.
+ # * <tt>:address</tt> - Allows you to use a remote mail server. Just change it from its default "localhost" setting.
+ # * <tt>:port</tt> - On the off chance that your mail server doesn't run on port 25, you can change it.
+ # * <tt>:domain</tt> - If you need to specify a HELO domain, you can do it here.
+ # * <tt>:user_name</tt> - If your mail server requires authentication, set the username in this setting.
+ # * <tt>:password</tt> - If your mail server requires authentication, set the password in this setting.
+ # * <tt>:authentication</tt> - If your mail server requires authentication, you need to specify the authentication type here.
# This is a symbol and one of <tt>:plain</tt>, <tt>:login</tt>, <tt>:cram_md5</tt>
#
# * <tt>sendmail_settings</tt> - Allows you to override options for the <tt>:sendmail</tt> delivery method
- # * <tt>:location</tt> The location of the sendmail executable, defaults to "/usr/sbin/sendmail"
- # * <tt>:arguments</tt> The command line arguments
- # * <tt>raise_delivery_errors</tt> - whether or not errors should be raised if the email fails to be delivered.
+ # * <tt>:location</tt> - The location of the sendmail executable, defaults to "/usr/sbin/sendmail"
+ # * <tt>:arguments</tt> - The command line arguments
+ #
+ # * <tt>raise_delivery_errors</tt> - Whether or not errors should be raised if the email fails to be delivered.
#
# * <tt>delivery_method</tt> - Defines a delivery method. Possible values are <tt>:smtp</tt> (default), <tt>:sendmail</tt>, and <tt>:test</tt>.
#
- # * <tt>perform_deliveries</tt> - Determines whether deliver_* methods are actually carried out. By default they are,
+ # * <tt>perform_deliveries</tt> - Determines whether <tt>deliver_*</tt> methods are actually carried out. By default they are,
# but this can be turned off to help functional testing.
#
# * <tt>deliveries</tt> - Keeps an array of all the emails sent out through the Action Mailer with <tt>delivery_method :test</tt>. Most useful
@@ -406,7 +407,7 @@ def deliver(mail)
# templating language other than rhtml or rxml are supported.
# To use this, include in your template-language plugin's init
# code or on a per-application basis, this can be invoked from
- # config/environment.rb:
+ # <tt>config/environment.rb</tt>:
#
# ActionMailer::Base.register_template_extension('haml')
def register_template_extension(extension)
@@ -21,11 +21,11 @@ module Assertions
# from the response HTML or elements selected by the enclosing assertion.
#
# In addition to HTML responses, you can make the following assertions:
- # * #assert_select_rjs -- Assertions on HTML content of RJS update and
+ # * +assert_select_rjs+ - Assertions on HTML content of RJS update and
# insertion operations.
- # * #assert_select_encoded -- Assertions on HTML encoded inside XML,
+ # * +assert_select_encoded+ - Assertions on HTML encoded inside XML,
# for example for dealing with feed item descriptions.
- # * #assert_select_email -- Assertions on the HTML body of an e-mail.
+ # * +assert_select_email+ - Assertions on the HTML body of an e-mail.
#
# Also see HTML::Selector to learn how to use selectors.
module SelectorAssertions
@@ -136,27 +136,27 @@ def css_select(*args)
# === Equality Tests
#
# The equality test may be one of the following:
- # * <tt>true</tt> -- Assertion is true if at least one element selected.
- # * <tt>false</tt> -- Assertion is true if no element selected.
- # * <tt>String/Regexp</tt> -- Assertion is true if the text value of at least
+ # * <tt>true</tt> - Assertion is true if at least one element selected.
+ # * <tt>false</tt> - Assertion is true if no element selected.
+ # * <tt>String/Regexp</tt> - Assertion is true if the text value of at least
# one element matches the string or regular expression.
- # * <tt>Integer</tt> -- Assertion is true if exactly that number of
+ # * <tt>Integer</tt> - Assertion is true if exactly that number of
# elements are selected.
- # * <tt>Range</tt> -- Assertion is true if the number of selected
+ # * <tt>Range</tt> - Assertion is true if the number of selected
# elements fit the range.
# If no equality test specified, the assertion is true if at least one
# element selected.
#
# To perform more than one equality tests, use a hash with the following keys:
- # * <tt>:text</tt> -- Narrow the selection to elements that have this text
+ # * <tt>:text</tt> - Narrow the selection to elements that have this text
# value (string or regexp).
- # * <tt>:html</tt> -- Narrow the selection to elements that have this HTML
+ # * <tt>:html</tt> - Narrow the selection to elements that have this HTML
# content (string or regexp).
- # * <tt>:count</tt> -- Assertion is true if the number of selected elements
+ # * <tt>:count</tt> - Assertion is true if the number of selected elements
# is equal to this value.
- # * <tt>:minimum</tt> -- Assertion is true if the number of selected
+ # * <tt>:minimum</tt> - Assertion is true if the number of selected
# elements is at least this value.
- # * <tt>:maximum</tt> -- Assertion is true if the number of selected
+ # * <tt>:maximum</tt> - Assertion is true if the number of selected
# elements is at most this value.
#
# If the method is called with a block, once all equality tests are
@@ -159,28 +159,34 @@ class UnknownHttpMethod < ActionControllerError #:nodoc:
#
# Hello #{session[:person]}
#
- # For removing objects from the session, you can either assign a single key to nil, like <tt>session[:person] = nil</tt>, or you can
- # remove the entire session with reset_session.
+ # For removing objects from the session, you can either assign a single key to +nil+:
#
- # Sessions are stored in a browser cookie that's cryptographically signed, but unencrypted, by default. This prevents
- # the user from tampering with the session but also allows him to see its contents.
+ # # removes :person from session
+ # session[:person] = nil
#
- # Do not put secret information in session!
+ # or you can remove the entire session with +reset_session+.
+ #
+ # Sessions are stored by default in a browser cookie that's cryptographically signed, but unencrypted.
+ # This prevents the user from tampering with the session but also allows him to see its contents.
+ #
+ # Do not put secret information in cookie-based sessions!
#
# Other options for session storage are:
#
- # ActiveRecordStore: sessions are stored in your database, which works better than PStore with multiple app servers and,
- # unlike CookieStore, hides your session contents from the user. To use ActiveRecordStore, set
+ # * ActiveRecordStore - Sessions are stored in your database, which works better than PStore with multiple app servers and,
+ # unlike CookieStore, hides your session contents from the user. To use ActiveRecordStore, set
#
- # config.action_controller.session_store = :active_record_store
+ # config.action_controller.session_store = :active_record_store
#
- # in your <tt>environment.rb</tt> and run <tt>rake db:sessions:create</tt>.
+ # in your <tt>config/environment.rb</tt> and run <tt>rake db:sessions:create</tt>.
#
- # MemCacheStore: sessions are stored as entries in your memcached cache. Set the session store type in <tt>environment.rb</tt>:
+ # * MemCacheStore - Sessions are stored as entries in your memcached cache.
+ # Set the session store type in <tt>config/environment.rb</tt>:
#
- # config.action_controller.session_store = :mem_cache_store
+ # config.action_controller.session_store = :mem_cache_store
#
- # This assumes that memcached has been installed and configured properly. See the MemCacheStore docs for more information.
+ # This assumes that memcached has been installed and configured properly.
+ # See the MemCacheStore docs for more information.
#
# == Responses
#
@@ -535,20 +541,20 @@ def process(request, response, method = :perform_action, *arguments) #:nodoc:
#
# <tt>url_for</tt> is used to:
#
- # All keys given to url_for are forwarded to the Route module, save for the following:
- # * <tt>:anchor</tt> -- specifies the anchor name to be appended to the path. For example,
+ # All keys given to +url_for+ are forwarded to the Route module, save for the following:
+ # * <tt>:anchor</tt> - Specifies the anchor name to be appended to the path. For example,
# <tt>url_for :controller => 'posts', :action => 'show', :id => 10, :anchor => 'comments'</tt>
# will produce "/posts/show/10#comments".
- # * <tt>:only_path</tt> -- if true, returns the relative URL (omitting the protocol, host name, and port) (<tt>false</tt> by default)
- # * <tt>:trailing_slash</tt> -- if true, adds a trailing slash, as in "/archive/2005/". Note that this
+ # * <tt>:only_path</tt> - If true, returns the relative URL (omitting the protocol, host name, and port) (<tt>false</tt> by default).
+ # * <tt>:trailing_slash</tt> - If true, adds a trailing slash, as in "/archive/2005/". Note that this
# is currently not recommended since it breaks caching.
- # * <tt>:host</tt> -- overrides the default (current) host if provided.
- # * <tt>:protocol</tt> -- overrides the default (current) protocol if provided.
- # * <tt>:port</tt> -- optionally specify the port to connect to.
- # * <tt>:user</tt> -- Inline HTTP authentication (only plucked out if <tt>:password</tt> is also present).
- # * <tt>:password</tt> -- Inline HTTP authentication (only plucked out if <tt>:user</tt> is also present).
- # * <tt>:skip_relative_url_root</tt> -- if true, the url is not constructed using the relative_url_root of the request so the path
- # will include the web server relative installation directory.
+ # * <tt>:host</tt> - Overrides the default (current) host if provided.
+ # * <tt>:protocol</tt> - Overrides the default (current) protocol if provided.
+ # * <tt>:port</tt> - Optionally specify the port to connect to.
+ # * <tt>:user</tt> - Inline HTTP authentication (only plucked out if <tt>:password</tt> is also present).
+ # * <tt>:password</tt> - Inline HTTP authentication (only plucked out if <tt>:user</tt> is also present).
+ # * <tt>:skip_relative_url_root</tt> - If true, the url is not constructed using the +relative_url_root+
+ # of the request so the path will include the web server relative installation directory.
#
# The URL is generated from the remaining keys in the hash. A URL contains two key parts: the <base> and a query string.
# Routes composes a query string as the key/value pairs not included in the <base>.
@@ -20,7 +20,8 @@ module ActionController #:nodoc:
#
# == Caching stores
#
- # All the caching stores from ActiveSupport::Cache is available to be used as backends for Action Controller caching.
+ # All the caching stores from ActiveSupport::Cache is available to be used as backends for Action Controller caching. This setting only
+ # affects action and fragment caching as page caching is always written to disk.
#
# Configuration examples (MemoryStore is the default):
#
@@ -4,23 +4,24 @@
module ActionController #:nodoc:
module Caching
# Page caching is an approach to caching where the entire action output of is stored as a HTML file that the web server
- # can serve without going through the Action Pack. This can be as much as 100 times faster than going through the process of dynamically
- # generating the content. Unfortunately, this incredible speed-up is only available to stateless pages where all visitors
- # are treated the same. Content management systems -- including weblogs and wikis -- have many pages that are a great fit
- # for this approach, but account-based systems where people log in and manipulate their own data are often less likely candidates.
+ # can serve without going through Action Pack. This is the fastest way to cache your content as opposed to going dynamically
+ # through the process of generating the content. Unfortunately, this incredible speed-up is only available to stateless pages
+ # where all visitors are treated the same. Content management systems -- including weblogs and wikis -- have many pages that are
+ # a great fit for this approach, but account-based systems where people log in and manipulate their own data are often less
+ # likely candidates.
#
- # Specifying which actions to cache is done through the <tt>caches</tt> class method:
+ # Specifying which actions to cache is done through the <tt>caches_page</tt> class method:
#
# class WeblogController < ActionController::Base
# caches_page :show, :new
# end
#
- # This will generate cache files such as weblog/show/5 and weblog/new, which match the URLs used to trigger the dynamic
- # generation. This is how the web server is able pick up a cache file when it exists and otherwise let the request pass on to
- # the Action Pack to generate it.
+ # This will generate cache files such as <tt>weblog/show/5.html</tt> and <tt>weblog/new.html</tt>,
+ # which match the URLs used to trigger the dynamic generation. This is how the web server is able
+ # pick up a cache file when it exists and otherwise let the request pass on to Action Pack to generate it.
#
# Expiration of the cache is handled by deleting the cached file, which results in a lazy regeneration approach where the cache
- # is not restored before another hit is made against it. The API for doing so mimics the options from url_for and friends:
+ # is not restored before another hit is made against it. The API for doing so mimics the options from +url_for+ and friends:
#
# class WeblogController < ActionController::Base
# def update
@@ -35,13 +36,17 @@ module Caching
#
# == Setting the cache directory
#
- # The cache directory should be the document root for the web server and is set using Base.page_cache_directory = "/document/root".
- # For Rails, this directory has already been set to Rails.public_path (which is usually set to RAILS_ROOT + "/public").
+ # The cache directory should be the document root for the web server and is set using <tt>Base.page_cache_directory = "/document/root"</tt>.
+ # For Rails, this directory has already been set to Rails.public_path (which is usually set to <tt>RAILS_ROOT + "/public"</tt>). Changing
+ # this setting can be useful to avoid naming conflicts with files in <tt>public/</tt>, but doing so will likely require configuring your
+ # web server to look in the new location for cached files.
#
# == Setting the cache extension
#
- # By default, the cache extension is .html, which makes it easy for the cached files to be picked up by the web server. If you want
- # something else, like .php or .shtml, just set Base.page_cache_extension.
+ # Most Rails requests do not have an extension, such as <tt>/weblog/new</tt>. In these cases, the page caching mechanism will add one in
+ # order to make it easy for the cached files to be picked up properly by the web server. By default, this cache extension is <tt>.html</tt>.
+ # If you want something else, like <tt>.php</tt> or <tt>.shtml</tt>, just set Base.page_cache_extension. In cases where a request already has an
+ # extension, such as <tt>.xml</tt> or <tt>.rss</tt>, page caching will not add an extension. This allows it to work well with RESTful apps.
module Pages
def self.included(base) #:nodoc:
base.extend(ClassMethods)
@@ -47,25 +47,27 @@ module PolymorphicRoutes
# Constructs a call to a named RESTful route for the given record and returns the
# resulting URL string. For example:
#
- # polymorphic_url(post)
- # # calls post_url(post) #=> "http://example.com/posts/1"
+ # # calls post_url(post)
+ # polymorphic_url(post) # => "http://example.com/posts/1"
#
# ==== Options
- # * <tt>:action</tt> -- specifies the action prefix for the named route:
- # <tt>:new</tt>, <tt>:edit</tt> or <tt>:formatted</tt>. Default is no prefix.
- # * <tt>:routing_type</tt> -- <tt>:path</tt> or <tt>:url</tt> (default <tt>:url</tt>).
+ #
+ # * <tt>:action</tt> - Specifies the action prefix for the named route:
+ # <tt>:new</tt>, <tt>:edit</tt>, or <tt>:formatted</tt>. Default is no prefix.
+ # * <tt>:routing_type</tt> - Allowed values are <tt>:path</tt> or <tt>:url</tt>.
+ # Default is <tt>:url</tt>.
#
# ==== Examples
#
# # an Article record
- # polymorphic_url(record) #-> article_url(record)
+ # polymorphic_url(record) # same as article_url(record)
#
# # a Comment record
- # polymorphic_url(record) #-> comment_url(record)
+ # polymorphic_url(record) # same as comment_url(record)
#
# # it recognizes new records and maps to the collection
# record = Comment.new
- # polymorphic_url(record) #-> comments_url()
+ # polymorphic_url(record) # same as comments_url()
#
def polymorphic_url(record_or_hash_or_array, options = {})
if record_or_hash_or_array.kind_of?(Array)
@@ -69,10 +69,10 @@ module ClassMethods
#
# Valid Options:
#
- # * <tt>:only/:except</tt> - passed to the <tt>before_filter</tt> call. Set which actions are verified.
+ # * <tt>:only/:except</tt> - Passed to the <tt>before_filter</tt> call. Set which actions are verified.
# * <tt>:secret</tt> - Custom salt used to generate the <tt>form_authenticity_token</tt>.
# Leave this off if you are using the cookie session store.
- # * <tt>:digest</tt> - Message digest used for hashing. Defaults to 'SHA1'
+ # * <tt>:digest</tt> - Message digest used for hashing. Defaults to 'SHA1'.
def protect_from_forgery(options = {})
self.request_forgery_protection_token ||= :authenticity_token
before_filter :verify_authenticity_token, :only => options.delete(:only), :except => options.delete(:except)
Oops, something went wrong.

0 comments on commit dc4eec1

Please sign in to comment.