Permalink
Browse files

Fixed docs (closes #2468)

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2749 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
dhh committed Oct 26, 2005
1 parent 0b92d38 commit 82f1e19e4c493920e692309d15f66677ac8063e5
@@ -8,9 +8,9 @@ module Unit #:nodoc:
# In addition to these specific assertions, you also have easy access to various collections that the regular test/unit assertions
# can be used against. These collections are:
#
- # * assigns: Instance variables assigned in the action that's available for the view.
+ # * assigns: Instance variables assigned in the action that are available for the view.
# * session: Objects being saved in the session.
- # * flash: The flash objects being currently in the session.
+ # * flash: The flash objects currently in the session.
# * cookies: Cookies being sent to the user on this request.
#
# These collections can be used just like any other hash:
@@ -25,13 +25,13 @@ module Unit #:nodoc:
#
# On top of the collections, you have the complete url that a given action redirected to available in redirect_to_url.
#
- # For redirects within the same controller, you can even call follow_redirect and the redirect will be follow triggering another
+ # For redirects within the same controller, you can even call follow_redirect and the redirect will be followed, triggering another
# action call which can then be asserted against.
#
# == Manipulating the request collections
#
- # The collections described above link to the response, so you can test if what the actions were expected to do happen. But
- # some times you also want to manipulate these collections in the request coming in. This is really only relevant for sessions
+ # The collections described above link to the response, so you can test if what the actions were expected to do happened. But
+ # sometimes you also want to manipulate these collections in the incoming request. This is really only relevant for sessions
# and cookies, though. For sessions, you just do:
#
# @request.session[:key] = "value"
@@ -68,7 +68,7 @@ def assert_response(type, message = nil)
end
# Assert that the redirection options passed in match those of the redirect called in the latest action. This match can be partial,
- # such at assert_redirected_to(:controller => "weblog") will also match the redirection of
+ # such that assert_redirected_to(:controller => "weblog") will also match the redirection of
# redirect_to(:controller => "weblog", :action => "show") and so on.
def assert_redirected_to(options = {}, message=nil)
clean_backtrace do
@@ -118,7 +118,7 @@ def assert_template(expected = nil, message=nil)
end
end
- # Asserts that the routing of the given path is handled correctly and that the parsed options match.
+ # Asserts that the routing of the given path was handled correctly and that the parsed options match.
def assert_recognizes(expected_options, path, extras={}, message=nil)
clean_backtrace do
path = "/#{path}" unless path[0..0] == '/'
@@ -159,8 +159,8 @@ def assert_generates(expected_path, options, defaults={}, extras = {}, message=n
end
end
- # asserts that path and options match both ways, in other words, the URL generated from
- # options is same as path, and also that the options recognized from path are same as options
+ # Asserts that path and options match both ways; in other words, the URL generated from
+ # options is the same as path, and also that the options recognized from path are the same as options
def assert_routing(path, options, defaults={}, extras={}, message=nil)
assert_recognizes(options, path, extras, message)
@@ -89,7 +89,7 @@ def initialize(message=nil)
#
# == Parameters
#
- # All request parameters whether they come from a GET or POST request, or from the URL, are available through the params hash.
+ # All request parameters, whether they come from a GET or POST request, or from the URL, are available through the params hash.
# So an action that was performed through /weblog/list?category=All&limit=5 will include { "category" => "All", "limit" => 5 }
# in params.
#
@@ -165,7 +165,7 @@ def initialize(message=nil)
# the post again, but rather just show it one more time.
#
# This sounds fairly simple, but the redirection is complicated by the quest for a phenomenon known as "pretty urls". Instead of accepting
- # the dreadful beings that is "weblog_controller?action=show&post_id=5", Action Controller goes out of its way to represent the former as
+ # the dreadful being that is "weblog_controller?action=show&post_id=5", Action Controller goes out of its way to represent the former as
# "/weblog/show/5". And this is even the simple case. As an example of a more advanced pretty url consider
# "/library/books/ISBN/0743536703/show", which can be mapped to books_controller?action=show&type=ISBN&id=0743536703.
#
@@ -188,7 +188,7 @@ def initialize(message=nil)
#
# == Calling multiple redirects or renders
#
- # An action should conclude by a single render or redirect. Attempting to try to do either again will result in a DoubleRenderError:
+ # An action should conclude with a single render or redirect. Attempting to try to do either again will result in a DoubleRenderError:
#
# def do_something
# redirect_to :action => "elsewhere"
@@ -241,7 +241,7 @@ class Base
@@debug_routes = true
cattr_accessor :debug_routes
- # Controls whether the application is thread-safe, so multi-threaded servers like WEBrick knows whether to apply a mutex
+ # Controls whether the application is thread-safe, so multi-threaded servers like WEBrick know whether to apply a mutex
# around the performance of each action. Action Pack and Active Record are by default thread-safe, but many applications
# may not be. Turned off by default.
@@allow_concurrency = false
@@ -276,7 +276,7 @@ class Base
attr_accessor :response
# Holds a hash of objects in the session. Accessed like <tt>session[:person]</tt> to get the object tied to the "person"
- # key. The session will hold any type of object as values, but the key should be a string.
+ # key. The session will hold any type of object as values, but the key should be a string or symbol.
attr_accessor :session
# Holds a hash of header names and values. Accessed like <tt>headers["Cache-Control"]</tt> to get the value of the Cache-Control
@@ -306,7 +306,7 @@ def controller_name
@controller_name ||= controller_class_name.sub(/Controller$/, '').underscore
end
- # Convert the class name from something like "OneModule::TwoModule::NeatController" to "one_module/two_module/neat".
+ # Converts the class name from something like "OneModule::TwoModule::NeatController" to "one_module/two_module/neat".
def controller_path
unless @controller_path
components = self.name.to_s.split('::')
@@ -373,7 +373,7 @@ 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:
+ # 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".
@@ -408,7 +408,7 @@ def process(request, response, method = :perform_action, *arguments) #:nodoc:
# The final rule is applied while the URL is being generated and is best illustrated by an example. Let us consider the
# route given by <tt>map.connect 'people/:last/:first/:action', :action => 'bio', :controller => 'people'</tt>.
#
- # Suppose that the current URL is "people/hh/david/contacts". Let's consider a few different cases URLs which are generated
+ # Suppose that the current URL is "people/hh/david/contacts". Let's consider a few different cases of URLs which are generated
# from this page.
#
# * <tt>url_for :action => 'bio'</tt> -- During the generation of this URL, default values will be used for the first and
@@ -436,7 +436,7 @@ def process(request, response, method = :perform_action, *arguments) #:nodoc:
# url_for :overwrite_params => { :action => 'print' }
#
# This takes the current URL as is and only exchanges the action. In contrast, <tt>url_for :action => 'print'</tt>
- # would have slashed-off the path components are the changed action.
+ # would have slashed-off the path components after the changed action.
def url_for(options = {}, *parameters_for_method_reference) #:doc:
case options
when String then options
@@ -481,7 +481,7 @@ def controller_name
#
# === Rendering partials
#
- # Partial rendering is most commonly used together with Ajax calls that only updates one or a few elements on a page
+ # Partial rendering is most commonly used together with Ajax calls that only update one or a few elements on a page
# without reloading. Rendering of partials from the controller makes it possible to use the same partial template in
# both the full-page rendering (by calling it from within the template) and when sub-page updates happen (from the
# controller action responding to Ajax calls). By default, the current layout is not used.
@@ -683,7 +683,7 @@ def erase_render_results
@performed_render = false
end
- # Clears the redirected results from the headers, resetting the status to 200 and returns
+ # Clears the redirected results from the headers, resets the status to 200 and returns
# the URL that was used to redirect or nil if there was no redirected URL
# Note that +redirect_to+ will change the body of the response to indicate a redirection.
# The response body is not reset here, see +erase_render_results+
@@ -18,7 +18,7 @@ def self.append_features(base) #:nodoc:
end
# 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 the process of dynamically
+ # 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.
@@ -140,7 +140,7 @@ def caching_allowed
# Action caching is similar to page caching by the fact that the entire output of the response is cached, but unlike page caching,
# every request still goes through the Action Pack. The key benefit of this is that filters are run before the cache is served, which
- # allows for authentication and other restrictions on whether someone are supposed to see the cache. Example:
+ # allows for authentication and other restrictions on whether someone is allowed to see the cache. Example:
#
# class ListsController < ApplicationController
# before_filter :authenticate, :except => :public
@@ -228,7 +228,7 @@ def after(controller)
# In order to use the fragment caching, you need to designate where the caches should be stored. This is done by assigning a fragment store
# of which there are four different kinds:
#
- # * FileStore: Keeps the fragments on disk in the +cache_path+, which works well for all types of environments and share the fragments for
+ # * FileStore: Keeps the fragments on disk in the +cache_path+, which works well for all types of environments and shares the fragments for
# all the web server processes running off the same application directory.
# * MemoryStore: Keeps the fragments in memory, which is fine for WEBrick and for FCGI (if you don't care that each FCGI process holds its
# own fragment store). It's not suitable for CGI as the process is thrown away at the end of each request. It can potentially also take
@@ -481,14 +481,14 @@ def initialize(cache_path)
# end
# end
#
- # The sweeper is assigned on the controllers that wish to have its job performed using the <tt>cache_sweeper</tt> class method:
+ # The sweeper is assigned in the controllers that wish to have its job performed using the <tt>cache_sweeper</tt> class method:
#
# class ListsController < ApplicationController
# caches_action :index, :show, :public, :feed
# cache_sweeper :list_sweeper, :only => [ :edit, :destroy, :share ]
# end
#
- # In the example above, four actions are cached and three actions are responsible of expiring those caches.
+ # In the example above, four actions are cached and three actions are responsible for expiring those caches.
module Sweeping
def self.append_features(base) #:nodoc:
super
@@ -1,5 +1,5 @@
module ActionController #:nodoc:
- # Components allows you to call other actions for their rendered response while execution another action. You can either delegate
+ # Components allows you to call other actions for their rendered response while executing another action. You can either delegate
# the entire response rendering or you can mix a partial response in with your other content.
#
# class WeblogController < ActionController::Base
@@ -1,6 +1,6 @@
module ActionController #:nodoc:
- # Cookies are read and written through ActionController#cookies. The cookies being read is what was received along with the request,
- # the cookies being written is what will be sent out will the response. Cookies are read by value (so you won't get the cookie object
+ # Cookies are read and written through ActionController#cookies. The cookies being read are what were received along with the request,
+ # the cookies being written are what will be sent out with the response. Cookies are read by value (so you won't get the cookie object
# itself back -- just the value it holds). Examples for writing:
#
# cookies[:user_name] = "david" # => Will set a simple session cookie
@@ -43,7 +43,7 @@ def initialize(controller)
update(@cookies)
end
- # Returns the value of the cookie by +name+ -- or nil if no such cookie exist. You set new cookies using either the cookie method
+ # Returns the value of the cookie by +name+ -- or nil if no such cookie exists. You set new cookies using either the cookie method
# or cookies[]= (for simple name/value cookies without options).
def [](name)
@cookies[name.to_s].value.first if @cookies[name.to_s] && @cookies[name.to_s].respond_to?(:value)
@@ -27,7 +27,7 @@ def self.append_features(base)
# end
#
# Also note, that if the models follow the pattern of just 1 class per file in the form of MyClass => my_class.rb, then these
- # classes doesn't have to be required as Active Support will auto-require them.
+ # classes don't have to be required as Active Support will auto-require them.
module ClassMethods
# Specifies a variable number of models that this controller depends on. Models are normally Active Record classes or a similar
# backend for modelling entity classes.
@@ -41,7 +41,7 @@ def self.append_features(base)
#
# Now any actions performed on the BankController will have the audit method called before. On the VaultController,
# first the audit method is called, then the verify_credentials method. If the audit method returns false, then
- # verify_credentials and the intended action is never called.
+ # verify_credentials and the intended action are never called.
#
# == Filter types
#
@@ -74,7 +74,7 @@ def self.append_features(base)
#
# As you can see, the block expects to be passed the controller after it has assigned the request to the internal variables.
# This means that the block has access to both the request and response objects complete with convenience methods for params,
- # session, template, and assigns. Note: The inline method doesn't strictly has to be a block. Any object that responds to call
+ # session, template, and assigns. Note: The inline method doesn't strictly have to be a block; any object that responds to call
# and returns 1 or -1 on arity will do (such as a Proc or an Method object).
#
# == Filter chain ordering
@@ -143,7 +143,7 @@ def self.append_features(base)
# end
# end
#
- # When setting conditions on inline method (proc) filters the condition must come first and be placed in parenthesis.
+ # When setting conditions on inline method (proc) filters the condition must come first and be placed in parentheses.
#
# class UserPreferences < ActionController::Base
# before_filter(:except => :new) { # some proc ... }
@@ -19,7 +19,7 @@ class << self
end
end
- # The template helpers serves to relieve the templates from including the same inline code again and again. It's a
+ # The template helpers serve to relieve the templates from including the same inline code again and again. It's a
# set of standardized methods for working with forms (FormHelper), dates (DateHelper), texts (TextHelper), and
# Active Records (ActiveRecordHelper) that's available to all templates by default.
#
@@ -24,7 +24,7 @@ class << self
# and if you ever want to change the structure of these two includes, you'll have to change all the templates.
#
# With layouts, you can flip it around and have the common structure know where to insert changing content. This means
- # that the header and footer is only mentioned in one place, like this:
+ # that the header and footer are only mentioned in one place, like this:
#
# <!-- The header part of this layout -->
# <%= @content_for_layout %>
@@ -56,7 +56,7 @@ def rescue_action_in_public(exception) #:doc:
end
end
- # Overwrite to expand the meaning of a local request in order to show local rescues on other occurences than
+ # Overwrite to expand the meaning of a local request in order to show local rescues on other occurrences than
# the remote IP being 127.0.0.1. For example, this could include the IP of the developer machine when debugging
# remotely.
def local_request? #:doc:

0 comments on commit 82f1e19

Please sign in to comment.