aboutsummaryrefslogtreecommitdiffstats
path: root/railties/doc/guides
diff options
context:
space:
mode:
authorMike Gunderloy <MikeG1@larkfarm.com>2009-01-31 10:33:29 -0600
committerMike Gunderloy <MikeG1@larkfarm.com>2009-01-31 10:33:29 -0600
commitcbf4bef492eb9e65e51019924e19346b1aba07ad (patch)
treea9b15beead5c828b729d9f85748af6b456c2561d /railties/doc/guides
parente4f36e05715b602c187c7618c086b7bada4db9ae (diff)
downloadrails-cbf4bef492eb9e65e51019924e19346b1aba07ad.tar.gz
rails-cbf4bef492eb9e65e51019924e19346b1aba07ad.tar.bz2
rails-cbf4bef492eb9e65e51019924e19346b1aba07ad.zip
Rebuild guides + relnotes HTML
Diffstat (limited to 'railties/doc/guides')
-rw-r--r--railties/doc/guides/html/2_2_release_notes.html5
-rw-r--r--railties/doc/guides/html/2_3_release_notes.html126
-rw-r--r--railties/doc/guides/html/action_mailer_basics.html358
-rw-r--r--railties/doc/guides/html/active_record_basics.html127
4 files changed, 455 insertions, 161 deletions
diff --git a/railties/doc/guides/html/2_2_release_notes.html b/railties/doc/guides/html/2_2_release_notes.html
index 0dec014c3e..b94ab7531f 100644
--- a/railties/doc/guides/html/2_2_release_notes.html
+++ b/railties/doc/guides/html/2_2_release_notes.html
@@ -993,6 +993,11 @@ The <tt>%s</tt> and <tt>%d</tt> interpolation syntax for internationalization is
Durations of fractional months or fractional years are deprecated. Use Ruby&#8217;s core <tt>Date</tt> and <tt>Time</tt> class arithmetic instead.
</p>
</li>
+<li>
+<p>
+<tt>Request#relative_url_root</tt> is deprecated. Use <tt>ActionController::Base.relative_url_root</tt> instead.
+</p>
+</li>
</ul></div>
</div>
<h2 id="_credits">12. Credits</h2>
diff --git a/railties/doc/guides/html/2_3_release_notes.html b/railties/doc/guides/html/2_3_release_notes.html
index 63fe1e78ea..228d213ff4 100644
--- a/railties/doc/guides/html/2_3_release_notes.html
+++ b/railties/doc/guides/html/2_3_release_notes.html
@@ -59,6 +59,8 @@
<li><a href="#_hash_conditions_for_tt_has_many_tt_relationships">Hash Conditions for <tt>has_many</tt> relationships</a></li>
+ <li><a href="#_reconnecting_mysql_connections">Reconnecting MySQL Connections</a></li>
+
<li><a href="#_other_active_record_changes">Other Active Record Changes</a></li>
</ul>
@@ -71,6 +73,8 @@
<li><a href="#_application_controller_renamed">Application Controller Renamed</a></li>
+ <li><a href="#_http_digest_authentication_support">HTTP Digest Authentication Support</a></li>
+
<li><a href="#_more_efficient_routing">More Efficient Routing</a></li>
<li><a href="#_rack_based_lazy_loaded_sessions">Rack-based Lazy-loaded Sessions</a></li>
@@ -81,6 +85,8 @@
<li><a href="#_improved_caching_performance">Improved Caching Performance</a></li>
+ <li><a href="#_localized_views">Localized Views</a></li>
+
<li><a href="#_other_action_controller_changes">Other Action Controller Changes</a></li>
</ul>
@@ -97,6 +103,8 @@
<li><a href="#_asset_hosts_as_objects">Asset Hosts as Objects</a></li>
+ <li><a href="#_grouped_options_for_select_helper_method">grouped_options_for_select Helper Method</a></li>
+
<li><a href="#_other_action_view_changes">Other Action View Changes</a></li>
</ul>
@@ -146,7 +154,7 @@
<h1>Ruby on Rails 2.3 Release Notes</h1>
<div id="preamble">
<div class="sectionbody">
-<div class="paragraph"><p>Rails 2.3 delivers a variety of new and improved features, including pervasive Rack integration, refreshed support for Rails Engines, nested transactions for Active Record, dynamic and default scopes, unified rendering, more efficient routing, application templates, and quiet backtraces. This list covers the major upgrades, but doesn&#8217;t include every little bug fix and change. If you want to see everything, check out the <a href="http://github.com/rails/rails/commits/master">list of commits</a> in the main Rails repository on GitHub.</p></div>
+<div class="paragraph"><p>Rails 2.3 delivers a variety of new and improved features, including pervasive Rack integration, refreshed support for Rails Engines, nested transactions for Active Record, dynamic and default scopes, unified rendering, more efficient routing, application templates, and quiet backtraces. This list covers the major upgrades, but doesn&#8217;t include every little bug fix and change. If you want to see everything, check out the <a href="http://github.com/rails/rails/commits/master">list of commits</a> in the main Rails repository on GitHub or review the <tt>CHANGELOG</tt> files for the individual Rails components.</p></div>
</div>
</div>
<h2 id="_application_architecture">1. Application Architecture</h2>
@@ -190,7 +198,7 @@ The FCGI handler goes through Rack
</li>
<li>
<p>
-ActionController::Dispatcher maintains its own default middleware stack. Middlewares can be injected in, reordered, and removed. The stack is compiled into a chain on boot. You can configure the middleware stack in <tt>environment.rb</tt>
+<tt>ActionController::Dispatcher</tt> maintains its own default middleware stack. Middlewares can be injected in, reordered, and removed. The stack is compiled into a chain on boot. You can configure the middleware stack in <tt>environment.rb</tt>
</p>
</li>
<li>
@@ -235,7 +243,7 @@ Session stores are now lazy loaded. If you never access the session object durin
</li>
<li>
<p>
-You can still change you session store with <tt>ActionController::Base.session_store = :active_record_store</tt>
+You can still change your session store with <tt>ActionController::Base.session_store = :active_record_store</tt>
</p>
</li>
<li>
@@ -321,7 +329,7 @@ Lead Contributors: <a href="http://www.workingwithrails.com/person/4985-jonathan
</li>
</ul></div>
<h3 id="_dynamic_scopes">3.2. Dynamic Scopes</h3>
-<div class="paragraph"><p>You know about dynamic finders in Rails (which allow you to concoct methods like <tt>find_by_color_and_flavor</tt> on the fly) and named scopes (which allow you to encapsulate reusable query conditions into friendly names like <tt>currently_active</tt>). Well, now you can have dynamic scope methods. The idea is to put together syntax that allows filtering on the fly &lt;i&gt;and&lt;/i&gt; method chaining. For example:</p></div>
+<div class="paragraph"><p>You know about dynamic finders in Rails (which allow you to concoct methods like <tt>find_by_color_and_flavor</tt> on the fly) and named scopes (which allow you to encapsulate reusable query conditions into friendly names like <tt>currently_active</tt>). Well, now you can have dynamic scope methods. The idea is to put together syntax that allows filtering on the fly <em>and</em> method chaining. For example:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 2.9
by Lorenzo Bettini
@@ -406,11 +414,20 @@ Lead Contributor: <a href="http://www.spacevatican.org/">Frederick Cheung</a>
</p>
</li>
</ul></div>
-<h3 id="_other_active_record_changes">3.7. Other Active Record Changes</h3>
+<h3 id="_reconnecting_mysql_connections">3.7. Reconnecting MySQL Connections</h3>
+<div class="paragraph"><p>MySQL supports a reconnect flag in its connections - if set to true, then the client will try reconnecting to the server before giving up in case of a lost connection. You can now set <tt>reconnect = true</tt> for your MySQL connections in <tt>database.yml</tt> to get this behavior from a Rails application. The default is <tt>false</tt>, so the behavior of existing applications doesn&#8217;t change.</p></div>
+<div class="ulist"><ul>
+<li>
+<p>
+Lead Contributor: <a href="http://twitter.com/dubek">Dov Murik</a>
+</p>
+</li>
+</ul></div>
+<h3 id="_other_active_record_changes">3.8. Other Active Record Changes</h3>
<div class="ulist"><ul>
<li>
<p>
-An extra <tt>AS</tt> was removed from the code for has_and_belongs_to_many preloading, making it work better for some databases.
+An extra <tt>AS</tt> was removed from the generated SQL for has_and_belongs_to_many preloading, making it work better for some databases.
</p>
</li>
<li>
@@ -443,6 +460,11 @@ Active Record&#8217;s <tt>to_xml</tt> support gets just a little bit more flexib
A bug in canceling callbacks from <tt>before_update</tt> or +before_create_ was fixed.
</p>
</li>
+<li>
+<p>
+Rake tasks for testing databases via JDBC have been added.
+</p>
+</li>
</ul></div>
</div>
<h2 id="_action_controller">4. Action Controller</h2>
@@ -468,7 +490,7 @@ http://www.gnu.org/software/src-highlite -->
render <span style="color: #FF0000">'other_controller/action'</span>
render <span style="color: #FF0000">'show'</span>
render <span style="color: #990000">:</span>show</tt></pre></div></div>
-<div class="paragraph"><p>Rails chooses between file, template, and action depending on whether there is a leading slash, an embedded slash, or no slash at all in what&#8217;s to be rendered. Note that you can also use a symbol instead of a string when rendering an action. Other rendering styles (<tt>:inline, :text, :update, :nothing, :json, :xml, :js</tt>) still require an explicit option.</p></div>
+<div class="paragraph"><p>Rails chooses between file, template, and action depending on whether there is a leading slash, an embedded slash, or no slash at all in what&#8217;s to be rendered. Note that you can also use a symbol instead of a string when rendering an action. Other rendering styles (<tt>:inline</tt>, <tt>:text</tt>, <tt>:update</tt>, <tt>:nothing</tt>, <tt>:json</tt>, <tt>:xml</tt>, <tt>:js</tt>) still require an explicit option.</p></div>
<h3 id="_application_controller_renamed">4.2. Application Controller Renamed</h3>
<div class="paragraph"><p>If you&#8217;re one of the people who has always been bothered by the special-case naming of <tt>application.rb</tt>, rejoice! It&#8217;s been reworked to be application_controller.rb in Rails 2.3. In addition, there&#8217;s a new rake task, <tt>rake rails:update:application_controller</tt> to do this automatically for you - and it will be run as part of the normal <tt>rake rails:update</tt> process.</p></div>
<div class="ulist"><ul>
@@ -490,12 +512,47 @@ More Information:
</ul></div>
</li>
</ul></div>
-<h3 id="_more_efficient_routing">4.3. More Efficient Routing</h3>
+<h3 id="_http_digest_authentication_support">4.3. HTTP Digest Authentication Support</h3>
+<div class="paragraph"><p>Rails now has built-in support for HTTP digest authentication. To use it, you call <tt>authenticate_or_request_with_http_digest</tt> with a block that returns the user’s password (which is then hashed and compared against the transmitted credentials):</p></div>
+<div class="listingblock">
+<div class="content"><!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">class</span></span> PostsController <span style="color: #990000">&lt;</span> ApplicationController
+ Users <span style="color: #990000">=</span> <span style="color: #FF0000">{</span><span style="color: #FF0000">"dhh"</span> <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"secret"</span><span style="color: #FF0000">}</span>
+ before_filter <span style="color: #990000">:</span>authenticate
+
+ <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> secret
+ render <span style="color: #990000">:</span>text <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"Password Required!"</span>
+ <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
+
+ private
+ <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> authenticate
+ realm <span style="color: #990000">=</span> <span style="color: #FF0000">"Application"</span>
+ authenticate_or_request_with_http_digest<span style="color: #990000">(</span>realm<span style="color: #990000">)</span> <span style="font-weight: bold"><span style="color: #0000FF">do</span></span> <span style="color: #990000">|</span>name<span style="color: #990000">|</span>
+ Users<span style="color: #990000">[</span>name<span style="color: #990000">]</span>
+ <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
+ <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
+<span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
+<div class="ulist"><ul>
+<li>
+<p>
+Lead Contributor: <a href="http://www.kellogg-assoc.com/">Gregg Kellogg</a>
+</p>
+</li>
+<li>
+<p>
+More Information: <a href="http://ryandaigle.com/articles/2009/1/30/what-s-new-in-edge-rails-http-digest-authentication">What&#8217;s New in Edge Rails: HTTP Digest Authentication</a>
+</p>
+</li>
+</ul></div>
+<h3 id="_more_efficient_routing">4.4. More Efficient Routing</h3>
<div class="paragraph"><p>There are a couple of significant routing changes in Rails 2.3. The <tt>formatted_</tt> route helpers are gone, in favor just passing in <tt>:format</tt> as an option. This cuts down the route generation process by 50% for any resource - and can save a substantial amount of memory (up to 100MB on large applications). If your code uses the <tt>formatted_</tt> helpers, it will still work for the time being - but that behavior is deprecated and your application will be more efficient if you rewrite those routes using the new standard. Another big change is that Rails now supports multiple routing files, not just routes.rb. You can use <tt>RouteSet#add_configuration_file</tt> to bring in more routes at any time - without clearing the currently-loaded routes. While this change is most useful for Engines, you can use it in any application that needs to load routes in batches.</p></div>
-<div class="paragraph"><p>Lead Contributors: <a href="http://blog.hungrymachine.com/">Aaron Batalion</a> and <a href="http://www.loudthinking.com/">David Heinemeier Hansson</a></p></div>
-<h3 id="_rack_based_lazy_loaded_sessions">4.4. Rack-based Lazy-loaded Sessions</h3>
+<div class="paragraph"><p>Lead Contributors: <a href="http://blog.hungrymachine.com/">Aaron Batalion</a></p></div>
+<h3 id="_rack_based_lazy_loaded_sessions">4.5. Rack-based Lazy-loaded Sessions</h3>
<div class="paragraph"><p>A big change pushed the underpinnings of Action Controller session storage down to the Rack level. This involved a good deal of work in the code, though it should be completely transparent to your Rails applications (as a bonus, some icky patches around the old CGI session handler got removed). It&#8217;s still significant, though, for one simple reason: non-Rails Rack applications have access to the same session storage handlers (and therefore the same session) as your Rails applications. In addition, sessions are now lazy-loaded (in line with the loading improvements to the rest of the framework). This means that you no longer need to explicitly disable sessions if you don&#8217;t want them; just don&#8217;t refer to them and they won&#8217;t load.</p></div>
-<h3 id="_mime_type_handling_changes">4.5. MIME Type Handling Changes</h3>
+<h3 id="_mime_type_handling_changes">4.6. MIME Type Handling Changes</h3>
<div class="paragraph"><p>There are a couple of changes to the code for handling MIME types in Rails. First, <tt>MIME::Type</tt> now implements the <tt>=~</tt> operator, making things much cleaner when you need to check for the presence of a type that has synonyms:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 2.9
@@ -510,9 +567,9 @@ Mime<span style="color: #990000">::</span>JS <span style="color: #990000">=~</sp
Mime<span style="color: #990000">::</span>JS <span style="color: #990000">=~</span> <span style="color: #FF0000">"application/javascript"</span> <span style="color: #990000">=&gt;</span> <span style="font-weight: bold"><span style="color: #0000FF">true</span></span></tt></pre></div></div>
<div class="paragraph"><p>The other change is that the framework now uses the <tt>Mime::JS</tt> when checking for javascript in various spots, making it handle those alternatives cleanly.</p></div>
<div class="paragraph"><p>Lead Contributor: <a href="http://www.workingwithrails.com/person/5510-seth-fitzsimmons">Seth Fitzsimmons</a></p></div>
-<h3 id="_optimization_of_tt_respond_to_tt">4.6. Optimization of <tt>respond_to</tt></h3>
+<h3 id="_optimization_of_tt_respond_to_tt">4.7. Optimization of <tt>respond_to</tt></h3>
<div class="paragraph"><p>In some of the first fruits of the Rails-Merb team merger, Rails 2.3 includes some optimizations for the <tt>respond_to</tt> method, which is of course heavily used in many Rails applications to allow your controller to format results differently based on the MIME type of the incoming request. After eliminating a call to <tt>method_missing</tt> and some profiling and tweaking, we&#8217;re seeing an 8% improvement in the number of requests per second served with a simple <tt>respond_to</tt> that switches between three formats. The best part? No change at all required to the code of your application to take advantage of this speedup.</p></div>
-<h3 id="_improved_caching_performance">4.7. Improved Caching Performance</h3>
+<h3 id="_improved_caching_performance">4.8. Improved Caching Performance</h3>
<div class="paragraph"><p>Rails now keeps a per-request local cache of requests, cutting down on unnecessary reads and leading to better site performance. While this work was originally limited to <tt>MemCacheStore</tt>, it is available to any remote store than implements the required methods.</p></div>
<div class="ulist"><ul>
<li>
@@ -521,7 +578,9 @@ Lead Contributor: <a href="http://www.motionstandingstill.com/">Nahum Wild</a>
</p>
</li>
</ul></div>
-<h3 id="_other_action_controller_changes">4.8. Other Action Controller Changes</h3>
+<h3 id="_localized_views">4.9. Localized Views</h3>
+<div class="paragraph"><p>Rails can now provide localized views, depending on the locale that you have set. For example, suppose you have a <tt>Posts</tt> controller with a <tt>show</tt> action. By default, this will render <tt>app/views/posts/show.html.erb</tt>. But if you set <tt>I18n.locale = :da</tt>, it will render <tt>app/views/posts/show.da.html.erb</tt>. If the localized template isn&#8217;t present, the undecorated version will be used. Rails also includes <tt>I18n#available_locales</tt> and <tt>I18n::SimpleBackend#available_locales</tt>, which return an array of the translations that are available in the current Rails project.</p></div>
+<h3 id="_other_action_controller_changes">4.10. Other Action Controller Changes</h3>
<div class="ulist"><ul>
<li>
<p>
@@ -535,7 +594,7 @@ The fact that Rails checks for IP spoofing can be a nuisance for sites that do h
</li>
<li>
<p>
-ActionController::Dispatcher now implements its own middleware stack, which you can see by running <tt>rake middleware</tt>.
+<tt>ActionController::Dispatcher</tt> now implements its own middleware stack, which you can see by running <tt>rake middleware</tt>.
</p>
</li>
<li>
@@ -553,15 +612,15 @@ You can now use symbols for the <tt>:type</tt> option of <tt>send_file</tt> and
<h2 id="_action_view">5. Action View</h2>
<div class="sectionbody">
<div class="paragraph"><p>Action View in Rails 2.3 picks up improvements to <tt>render</tt>, more flexible prompts for the date select helpers, and a speedup in asset caching, among other things.</p></div>
-<h3 id="_smart_rendering_of_partials">5.1. Smart Rendering of Partials</h3>
+<h3 id="_smart_rendering_of_partials">5.1. Smart Rendering of Partials</h3>
<div class="paragraph"><p>The render method has been getting smarter over the years, and it&#8217;s even smarter now. If you have an object or a collection and an appropriate partial, and the naming matches up, you can now just render the object and things will work. For example, in Rails 2.3, these render calls will work in your view (assuming sensible naming):</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 2.9
by Lorenzo Bettini
http://www.lorenzobettini.it
http://www.gnu.org/software/src-highlite -->
-<pre><tt>render <span style="color: #009900">@article</span> <span style="font-style: italic"><span style="color: #9A1900"># Equivalent of render :partial =&gt; 'articles/_article', :object =&gt; @article</span></span>
-render <span style="color: #009900">@articles</span> <span style="font-style: italic"><span style="color: #9A1900"># Equivalent of render :partial =&gt; 'articles/_article', :collection =&gt; @articles</span></span></tt></pre></div></div>
+<pre><tt>render <span style="color: #009900">@article</span> <span style="font-style: italic"><span style="color: #9A1900"># Equivalent of render :partial =&gt; 'articles/_article', :object =&gt; @article</span></span>
+render <span style="color: #009900">@articles</span> <span style="font-style: italic"><span style="color: #9A1900"># Equivalent of render :partial =&gt; 'articles/_article', :collection =&gt; @articles</span></span></tt></pre></div></div>
<div class="ulist"><ul>
<li>
<p>
@@ -596,7 +655,27 @@ More Information: <a href="http://github.com/dhh/asset-hosting-with-minimum-ssl/
</p>
</li>
</ul></div>
-<h3 id="_other_action_view_changes">5.5. Other Action View Changes</h3>
+<h3 id="_grouped_options_for_select_helper_method">5.5. grouped_options_for_select Helper Method</h3>
+<div class="paragraph"><p>Action View already haD a bunch of helpers to aid in generating select controls, but now there&#8217;s one more: <tt>grouped_options_for_select</tt>. This one accepts an array or hash of strings, and converts them into a string of <tt>option</tt> tags wrapped with <tt>optgroup</tt> tags. For example:</p></div>
+<div class="listingblock">
+<div class="content"><!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>grouped_options_for_select<span style="color: #990000">([[</span><span style="color: #FF0000">"Hats"</span><span style="color: #990000">,</span> <span style="color: #990000">[</span><span style="color: #FF0000">"Baseball Cap"</span><span style="color: #990000">,</span><span style="color: #FF0000">"Cowboy Hat"</span><span style="color: #990000">]]],</span>
+ <span style="color: #FF0000">"Cowboy Hat"</span><span style="color: #990000">,</span> <span style="color: #FF0000">"Choose a product..."</span><span style="color: #990000">)</span></tt></pre></div></div>
+<div class="paragraph"><p>returns</p></div>
+<div class="listingblock">
+<div class="content"><!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt><span style="color: #FF0000">&lt;option value=""&gt;</span>Choose a product<span style="color: #990000">...</span><span style="color: #FF0000">&lt;/option&gt;</span>
+<span style="color: #FF0000">&lt;optgroup label="Hats"&gt;</span>
+ <span style="color: #FF0000">&lt;option value="Baseball Cap"&gt;</span>Baseball Cap<span style="color: #FF0000">&lt;/option&gt;</span>
+ <span style="color: #FF0000">&lt;option selected="selected" value="Cowboy Hat"&gt;</span>Cowboy Hat<span style="color: #FF0000">&lt;/option&gt;</span>
+<span style="color: #FF0000">&lt;/optgroup&gt;</span></tt></pre></div></div>
+<h3 id="_other_action_view_changes">5.6. Other Action View Changes</h3>
<div class="ulist"><ul>
<li>
<p>
@@ -705,7 +784,7 @@ More Information:
</li>
</ul></div>
<h3 id="_application_templates">7.2. Application Templates</h3>
-<div class="paragraph"><p>Rails 2.3 incorporates Jeremy McAnally&#8217;s "rg":http://github.com/jeremymcanally/rg/tree/master application generator. What this means is that we now have template-based application generation built right into Rails; if you have a set of plugins you include in every application (among many other use cases), you can just set up a template once and use it over and over again when you run the <tt>rails</tt> command. There&#8217;s also a rake task to apply a template to an existing application:</p></div>
+<div class="paragraph"><p>Rails 2.3 incorporates Jeremy McAnally&#8217;s <a href="http://github.com/jeremymcanally/rg/tree/master">rg</a> application generator. What this means is that we now have template-based application generation built right into Rails; if you have a set of plugins you include in every application (among many other use cases), you can just set up a template once and use it over and over again when you run the <tt>rails</tt> command. There&#8217;s also a rake task to apply a template to an existing application:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 2.9
by Lorenzo Bettini
@@ -726,7 +805,7 @@ More Info:<a href="http://m.onkey.org/2008/12/4/rails-templates">Rails templates
</li>
</ul></div>
<h3 id="_quieter_backtraces">7.3. Quieter Backtraces</h3>
-<div class="paragraph"><p>Building on Thoughtbot&#8217;s "Quiet Backtrace":http://www.thoughtbot.com/projects/quietbacktrace plugin, which allows you to selectively remove lines from Test::Unit backtraces, Rails 2.3 implements <tt>ActiveSupport::BacktraceCleaner</tt> and <tt>Rails::BacktraceCleaner</tt> in core. This supports both filters (to perform regex-based substitutions on backtrace lines) and silencers (to remove backtrace lines entirely). Rails automatically adds silencers to get rid of the most common noise in a new application, and builds a <tt>config/backtrace_silencers.rb</tt> file to hold your own additions. This feature also enables prettier printing from any gem in the backtrace.</p></div>
+<div class="paragraph"><p>Building on Thoughtbot&#8217;s <a href="http://www.thoughtbot.com/projects/quietbacktrace">Quiet Backtrace</a> plugin, which allows you to selectively remove lines from <tt>Test::Unit</tt> backtraces, Rails 2.3 implements <tt>ActiveSupport::BacktraceCleaner</tt> and <tt>Rails::BacktraceCleaner</tt> in core. This supports both filters (to perform regex-based substitutions on backtrace lines) and silencers (to remove backtrace lines entirely). Rails automatically adds silencers to get rid of the most common noise in a new application, and builds a <tt>config/backtrace_silencers.rb</tt> file to hold your own additions. This feature also enables prettier printing from any gem in the backtrace.</p></div>
<h3 id="_faster_boot_time_in_development_mode_with_lazy_loading_autoload">7.4. Faster Boot Time in Development Mode with Lazy Loading/Autoload</h3>
<div class="paragraph"><p>Quite a bit of work was done to make sure that bits of Rails (and its dependencies) are only brought into memory when they&#8217;re actually needed. The core frameworks - Active Support, Active Record, Action Controller, Action Mailer and Action View - are now using <tt>autoload</tt> to lazy-load their individual classes. This work should help keep the memory footprint down and improve overall Rails performance.</p></div>
<div class="paragraph"><p>You can also specify (by using the new <tt>preload_frameworks</tt> option) whether the core libraries should be autoloaded at startup. This defaults to <tt>false</tt> so that Rails autoloads itself piece-by-piece, but there are some circumstances where you still need to bring in everything at once - Passenger and JRuby both want to see all of Rails loaded together.</p></div>
@@ -803,6 +882,11 @@ The <tt>:digest</tt> and <tt>:secret</tt> options to <tt>protect_from_forgery</t
Some integration test helpers have been removed. <tt>response.headers["Status"]</tt> and <tt>headers["Status"]</tt> will no longer return anything. Rack does not allow "Status" in its return headers. However you can still use the <tt>status</tt> and <tt>status_message</tt> helpers. <tt>response.headers["cookie"]</tt> and <tt>headers["cookie"]</tt> will no longer return any CGI cookies. You can inspect <tt>headers["Set-Cookie"]</tt> to see the raw cookie header or use the <tt>cookies</tt> helper to get a hash of the cookies sent to the client.
</p>
</li>
+<li>
+<p>
+<tt>formatted_polymorphic_url</tt> is deprecated. Use <tt>polymorphic_url</tt> with <tt>:format</tt> instead.
+</p>
+</li>
</ul></div>
</div>
<h2 id="_credits">9. Credits</h2>
diff --git a/railties/doc/guides/html/action_mailer_basics.html b/railties/doc/guides/html/action_mailer_basics.html
index 317f135e4c..c788591f72 100644
--- a/railties/doc/guides/html/action_mailer_basics.html
+++ b/railties/doc/guides/html/action_mailer_basics.html
@@ -31,19 +31,41 @@
<h2>Chapters</h2>
<ol>
<li>
- <a href="#_what_is_action_mailer">What is Action Mailer?</a>
+ <a href="#_introduction">Introduction</a>
</li>
<li>
- <a href="#_quick_walkthrough_to_creating_a_mailer">Quick walkthrough to creating a Mailer</a>
+ <a href="#_sending_emails">Sending Emails</a>
<ul>
- <li><a href="#_1_create_the_mailer">1. Create the mailer:</a></li>
+ <li><a href="#_walkthrough_to_generating_a_mailer">Walkthrough to generating a Mailer</a></li>
- <li><a href="#_2_edit_the_model">2. Edit the model:</a></li>
+ <li><a href="#_action_mailer_and_dynamic_deliver_methods">Action Mailer and dynamic deliver_ methods</a></li>
- <li><a href="#_3_create_the_mailer_view">3. Create the mailer view</a></li>
+ <li><a href="#_complete_list_of_actionmailer_user_settable_attributes">Complete List of ActionMailer user-settable attributes</a></li>
- <li><a href="#_4_wire_it_up_so_that_the_system_sends_the_email_when_a_user_signs_up">4. Wire it up so that the system sends the email when a user signs up</a></li>
+ <li><a href="#_mailer_views">Mailer Views</a></li>
+
+ <li><a href="#_action_mailer_layouts">Action Mailer Layouts</a></li>
+
+ <li><a href="#_sending_multipart_emails">Sending multipart emails</a></li>
+
+ </ul>
+ </li>
+ <li>
+ <a href="#_receiving_emails">Receiving Emails</a>
+ </li>
+ <li>
+ <a href="#_using_action_mailer_helpers">Using Action Mailer Helpers</a>
+ </li>
+ <li>
+ <a href="#_action_mailer_configuration">Action Mailer Configuration</a>
+ <ul>
+
+ <li><a href="#_example_action_mailer_configuration">Example Action Mailer Configuration</a></li>
+
+ <li><a href="#_action_mailer_configuration_for_gmail">Action Mailer Configuration for GMail</a></li>
+
+ <li><a href="#_configure_action_mailer_to_recognize_haml_templates">Configure Action Mailer to recognize HAML templates</a></li>
</ul>
</li>
@@ -66,15 +88,16 @@
<div class="paragraph"><p>This guide should provide you with all you need to get started in sending emails from your application, and will also cover how to test your mailers.</p></div>
</div>
</div>
-<h2 id="_what_is_action_mailer">1. What is Action Mailer?</h2>
+<h2 id="_introduction">1. Introduction</h2>
<div class="sectionbody">
<div class="paragraph"><p>Action Mailer allows you to send email from your application using a mailer model and views.
Yes, that is correct, in Rails, emails are used by creating Models that inherit from ActionMailer::Base. They live alongside other models in /app/models BUT they have views just like controllers that appear alongside other views in app/views.</p></div>
</div>
-<h2 id="_quick_walkthrough_to_creating_a_mailer">2. Quick walkthrough to creating a Mailer</h2>
+<h2 id="_sending_emails">2. Sending Emails</h2>
<div class="sectionbody">
<div class="paragraph"><p>Let&#8217;s say you want to send a welcome email to a user after they signup. Here is how you would go about this:</p></div>
-<h3 id="_1_create_the_mailer">2.1. 1. Create the mailer:</h3>
+<h3 id="_walkthrough_to_generating_a_mailer">2.1. Walkthrough to generating a Mailer</h3>
+<h4 id="_1_create_the_mailer">2.1.1. 1. Create the mailer:</h4>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 2.9
by Lorenzo Bettini
@@ -88,7 +111,7 @@ create test/fixtures/user_mailer
create app/models/user_mailer<span style="color: #990000">.</span>rb
create test/unit/user_mailer_test<span style="color: #990000">.</span>rb</tt></pre></div></div>
<div class="paragraph"><p>So we got the model, the fixtures, and the tests all created for us</p></div>
-<h3 id="_2_edit_the_model">2.2. 2. Edit the model:</h3>
+<h4 id="_2_edit_the_model">2.1.2. 2. Edit the model:</h4>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 2.9
by Lorenzo Bettini
@@ -122,7 +145,7 @@ subject: The subject of the email
sent_on: Timestamp for the email
content_type: The content type, by default is text/plain</p></div>
<div class="paragraph"><p>How about @body[:user]? Well anything you put in the @body hash will appear in the mailer view (more about mailer views below) as an instance variable ready for you to use, ie, in our example the mailer view will have a @user instance variable available for its consumption.</p></div>
-<h3 id="_3_create_the_mailer_view">2.3. 3. Create the mailer view</h3>
+<h4 id="_3_create_the_mailer_view">2.1.3. 3. Create the mailer view</h4>
<div class="paragraph"><p></p></div>
<div class="paragraph"><p>The file can look like:</p></div>
<div class="listingblock">
@@ -145,7 +168,7 @@ http://www.gnu.org/software/src-highlite -->
<span style="font-weight: bold"><span style="color: #0000FF">&lt;p&gt;</span></span>Thanks for joining and have a great day!<span style="font-weight: bold"><span style="color: #0000FF">&lt;/p&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/body&gt;</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/html&gt;</span></span></tt></pre></div></div>
-<h3 id="_4_wire_it_up_so_that_the_system_sends_the_email_when_a_user_signs_up">2.4. 4. Wire it up so that the system sends the email when a user signs up</h3>
+<h4 id="_4_wire_it_up_so_that_the_system_sends_the_email_when_a_user_signs_up">2.1.4. 4. Wire it up so that the system sends the email when a user signs up</h4>
<div class="paragraph"><p>There are 3 was to achieve this. One is to send the email from the controller that sends the email, another is to put it in a before_create block in the user model, and the last one is to use an observer on the user model. Whether you use the second or third methods is up to you, but staying away from the first is recommended. Not because it&#8217;s wrong, but because it keeps your controller clean, and keeps all logic related to the user model within the user model. This way, whichever way a user is created (from a web form, or from an API call, for example), we are guaranteed that the email will be sent.</p></div>
<div class="paragraph"><p></p></div>
<div class="listingblock">
@@ -190,10 +213,311 @@ http://www.gnu.org/software/src-highlite -->
UserMailer<span style="color: #990000">.</span>deliver_welcome_email<span style="color: #990000">(</span>user<span style="color: #990000">)</span>
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
-<div class="paragraph"><p>Notice how we call deliver_welcome_email? Where is that method? Well if you remember, we created a method called welcome_email in UserMailer, right? Well, as part of the "magic" of rails, we deliver the email identified by welcome_email by calling deliver_welcome_email.</p></div>
-<div class="paragraph"><p>That&#8217;s it! Now whenever your users signup, they will be greeted with a nice welcome email. Next up, we&#8217;ll talk about how to test a mailer model.</p></div>
+<div class="paragraph"><p>Notice how we call deliver_welcome_email? Where is that method? Well if you remember, we created a method called welcome_email in UserMailer, right? Well, as part of the "magic" of rails, we deliver the email identified by welcome_email by calling deliver_welcome_email. The next section will go through this in more detail.</p></div>
+<div class="paragraph"><p>That&#8217;s it! Now whenever your users signup, they will be greeted with a nice welcome email.</p></div>
+<h3 id="_action_mailer_and_dynamic_deliver_methods">2.2. Action Mailer and dynamic deliver_ methods</h3>
+<div class="paragraph"><p>So how does Action Mailer understand this deliver_welcome_email call? If you read the documentation (<a href="http://api.rubyonrails.org/files/vendor/rails/actionmailer/README.html">http://api.rubyonrails.org/files/vendor/rails/actionmailer/README.html</a>), you will find this in the "Sending Emails" section:</p></div>
+<div class="paragraph"><p>You never instantiate your mailer class. Rather, your delivery instance
+methods are automatically wrapped in class methods that start with the word
+deliver_ followed by the name of the mailer method that you would
+like to deliver. The signup_notification method defined above is
+delivered by invoking Notifier.deliver_signup_notification.</p></div>
+<div class="paragraph"><p>So, how exactly does this work?</p></div>
+<div class="paragraph"><p>In ActionMailer:Base, you will find this:</p></div>
+<div class="listingblock">
+<div class="content"><!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">def</span></span> method_missing<span style="color: #990000">(</span>method_symbol<span style="color: #990000">,</span> <span style="color: #990000">*</span>parameters<span style="color: #990000">)</span><span style="font-style: italic"><span style="color: #9A1900">#:nodoc:</span></span>
+ <span style="font-weight: bold"><span style="color: #0000FF">case</span></span> method_symbol<span style="color: #990000">.</span>id2name
+ <span style="font-weight: bold"><span style="color: #0000FF">when</span></span> <span style="color: #FF6600">/^create_([_a-z]\w*)/</span> <span style="font-weight: bold"><span style="color: #0000FF">then</span></span> new<span style="color: #990000">(</span><span style="color: #009900">$1</span><span style="color: #990000">,</span> <span style="color: #990000">*</span>parameters<span style="color: #990000">).</span>mail
+ <span style="font-weight: bold"><span style="color: #0000FF">when</span></span> <span style="color: #FF6600">/^deliver_([_a-z]\w*)/</span> <span style="font-weight: bold"><span style="color: #0000FF">then</span></span> new<span style="color: #990000">(</span><span style="color: #009900">$1</span><span style="color: #990000">,</span> <span style="color: #990000">*</span>parameters<span style="color: #990000">).</span>deliver!
+ <span style="font-weight: bold"><span style="color: #0000FF">when</span></span> <span style="color: #FF0000">"new"</span> <span style="font-weight: bold"><span style="color: #0000FF">then</span></span> <span style="font-weight: bold"><span style="color: #0000FF">nil</span></span>
+ <span style="font-weight: bold"><span style="color: #0000FF">else</span></span> <span style="font-weight: bold"><span style="color: #0000FF">super</span></span>
+ <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
+<span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
+<div class="paragraph"><p>Ah, this makes things so much clearer :) so if the method name starts with deliver_ followed by any combination of lowercase letters or underscore, method missing calls new on your mailer class UserMailer in our example above, sending the combination of lower case letters or underscore, along with the parameter. The resulting object is then sent the deliver! method, which well... delivers it.</p></div>
+<h3 id="_complete_list_of_actionmailer_user_settable_attributes">2.3. Complete List of ActionMailer user-settable attributes</h3>
+<div class="tableblock">
+<table rules="all"
+width="100%"
+frame="border"
+cellspacing="0" cellpadding="4">
+<col width="20%" />
+<col width="80%" />
+<tbody valign="top">
+<tr>
+<td align="left"><p class="table">bcc</p></td>
+<td align="left"><p class="table">Specify the BCC addresses for the message</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">body</p></td>
+<td align="left"><p class="table">Define the body of the message. This is either a Hash (in which case it specifies the variables to pass to the template when it is rendered), or a string, in which case it specifies the actual text of the message.</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">cc</p></td>
+<td align="left"><p class="table">Specify the CC addresses for the message.</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">charset</p></td>
+<td align="left"><p class="table">Specify the charset to use for the message. This defaults to the default_charset specified for ActionMailer::Base.</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">content_type</p></td>
+<td align="left"><p class="table">Specify the content type for the message. This defaults to &lt;text/plain in most cases, but can be automatically set in some situations.</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">from</p></td>
+<td align="left"><p class="table">Specify the from address for the message.</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">reply_to</p></td>
+<td align="left"><p class="table">Specify the address (if different than the "from" address) to direct replies to this message.</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">headers</p></td>
+<td align="left"><p class="table">Specify additional headers to be added to the message.</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">implicit_parts_order</p></td>
+<td align="left"><p class="table">Specify the order in which parts should be sorted, based on content-type. This defaults to the value for the default_implicit_parts_order.</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">mime_version</p></td>
+<td align="left"><p class="table">Defaults to "1.0", but may be explicitly given if needed.</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">recipient</p></td>
+<td align="left"><p class="table">The recipient addresses for the message, either as a string (for a single address) or an array (for multiple addresses).</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">sent_on</p></td>
+<td align="left"><p class="table">The date on which the message was sent. If not set (the default), the header will be set by the delivery agent.</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">subject</p></td>
+<td align="left"><p class="table">Specify the subject of the message.</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">template</p></td>
+<td align="left"><p class="table">Specify the template name to use for current message. This is the "base" template name, without the extension or directory, and may be used to have multiple mailer methods share the same template.</p></td>
+</tr>
+</tbody>
+</table>
+</div>
+<h3 id="_mailer_views">2.4. Mailer Views</h3>
+<div class="paragraph"><p>Mailer views are located in /app/views/name_of_mailer_class. The specific mailer view is known to the class because it&#8217;s name is the same as the mailer method. So for example, in our example from above, our mailer view for the welcome_email method will be in /app/views/user_mailer/welcome_email.html.erb for the html version and welcome_email.txt.erb for the plain text version.</p></div>
+<div class="paragraph"><p>To change the default mailer view for your action you do something like:</p></div>
+<div class="listingblock">
+<div class="content"><!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">class</span></span> UserMailer <span style="color: #990000">&lt;</span> ActionMailer<span style="color: #990000">::</span>Base
+
+ <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> welcome_email<span style="color: #990000">(</span>user<span style="color: #990000">)</span>
+ recipients user<span style="color: #990000">.</span>email
+ from <span style="color: #FF0000">"My Awesome Site Notifications&lt;notifications@example.com&gt;"</span>
+ subject <span style="color: #FF0000">"Welcome to My Awesome Site"</span>
+ sent_on Time<span style="color: #990000">.</span>now
+ body <span style="color: #FF0000">{</span><span style="color: #990000">:</span>user <span style="color: #990000">=&gt;</span> user<span style="color: #990000">,</span> <span style="color: #990000">:</span>url <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"http://example.com/login"</span><span style="color: #FF0000">}</span>
+ content_type <span style="color: #FF0000">"text/html"</span>
+
+ <span style="font-style: italic"><span style="color: #9A1900"># change the default from welcome_email.[html, txt].erb</span></span>
+ template <span style="color: #FF0000">"some_other_template"</span> <span style="font-style: italic"><span style="color: #9A1900"># this will be in app/views/user_mailer/some_other_template.[html, txt].erb</span></span>
+ <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
+
+<span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
+<h3 id="_action_mailer_layouts">2.5. Action Mailer Layouts</h3>
+<div class="paragraph"><p>Just like controller views, you can also have mailer layouts. The layout needs end in _mailer to be automatically recognized by your mailer as a layout. So in our UserMailer example, we need to call our layout user_mailer.[html,txt].erb. In order to use a different file just use:</p></div>
+<div class="listingblock">
+<div class="content"><!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">class</span></span> UserMailer <span style="color: #990000">&lt;</span> ActionMailer<span style="color: #990000">::</span>Base
+
+ layout <span style="color: #FF0000">'awesome'</span> <span style="font-style: italic"><span style="color: #9A1900"># will use awesome.html.erb as the layout</span></span>
+
+<span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
+<div class="paragraph"><p>Just like with controller views, use yield to render the view inside the layout.</p></div>
+<h3 id="_sending_multipart_emails">2.6. Sending multipart emails</h3>
+<div class="paragraph"><p>Coming soon!</p></div>
+</div>
+<h2 id="_receiving_emails">3. Receiving Emails</h2>
+<div class="sectionbody">
+</div>
+<h2 id="_using_action_mailer_helpers">4. Using Action Mailer Helpers</h2>
+<div class="sectionbody">
+</div>
+<h2 id="_action_mailer_configuration">5. Action Mailer Configuration</h2>
+<div class="sectionbody">
+<div class="paragraph"><p>The following configuration options are best made in one of the environment files (environment.rb, production.rb, etc...)</p></div>
+<div class="tableblock">
+<table rules="all"
+width="100%"
+frame="border"
+cellspacing="0" cellpadding="4">
+<col width="20%" />
+<col width="80%" />
+<tbody valign="top">
+<tr>
+<td align="left"><p class="table">template_root</p></td>
+<td align="left"><div><div class="paragraph"><p>Determines the base from which template references will be made.</p></div></div></td>
+</tr>
+<tr>
+<td align="left"><p class="table">logger</p></td>
+<td align="left"><div><div class="paragraph"><p>the logger is used for generating information on the mailing run if available.
+ Can be set to nil for no logging. Compatible with both Ruby&#8217;s own Logger and Log4r loggers.</p></div></div></td>
+</tr>
+<tr>
+<td align="left"><p class="table">smtp_settings</p></td>
+<td align="left"><div><div class="paragraph"><p>Allows detailed configuration for :smtp delivery method:</p></div>
+<div class="tableblock">
+<table rules="all"
+width="100%"
+frame="border"
+cellspacing="0" cellpadding="4">
+<col width="20%" />
+<col width="80%" />
+<tbody valign="top">
+<tr>
+<td align="left"><p class="table">:address</p></td>
+<td align="left"><p class="table">Allows you to use a remote mail server. Just change it from its default "localhost" setting.</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">:port</p></td>
+<td align="left"><p class="table">On the off chance that your mail server doesn&#8217;t run on port 25, you can change it.</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">:domain</p></td>
+<td align="left"><p class="table">If you need to specify a HELO domain, you can do it here.</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">:user_name</p></td>
+<td align="left"><p class="table">If your mail server requires authentication, set the username in this setting.</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">:password</p></td>
+<td align="left"><p class="table">If your mail server requires authentication, set the password in this setting.</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">:authentication</p></td>
+<td align="left"><p class="table">If your mail server requires authentication, you need to specify the authentication type here. This is a symbol and one of :plain, :login, :cram_md5.</p></td>
+</tr>
+</tbody>
+</table>
+</div></div></td>
+</tr>
+<tr>
+<td align="left"><p class="table">sendmail_settings</p></td>
+<td align="left"><div><div class="paragraph"><p>Allows you to override options for the :sendmail delivery method.</p></div>
+<div class="tableblock">
+<table rules="all"
+width="100%"
+frame="border"
+cellspacing="0" cellpadding="4">
+<col width="20%" />
+<col width="80%" />
+<tbody valign="top">
+<tr>
+<td align="left"><p class="table">:location</p></td>
+<td align="left"><p class="table">The location of the sendmail executable. Defaults to /usr/sbin/sendmail.</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">:arguments</p></td>
+<td align="left"><p class="table">The command line arguments. Defaults to -i -t.</p></td>
+</tr>
+</tbody>
+</table>
+</div></div></td>
+</tr>
+<tr>
+<td align="left"><p class="table">raise_delivery_errors</p></td>
+<td align="left"><div><div class="paragraph"><p>Whether or not errors should be raised if the email fails to be delivered.</p></div></div></td>
+</tr>
+<tr>
+<td align="left"><p class="table">delivery_method</p></td>
+<td align="left"><div><div class="paragraph"><p>Defines a delivery method. Possible values are :smtp (default), :sendmail, and :test.</p></div></div></td>
+</tr>
+<tr>
+<td align="left"><p class="table">perform_deliveries</p></td>
+<td align="left"><div><div class="paragraph"><p>Determines whether deliver_* methods are actually carried out. By default they are,
+ but this can be turned off to help functional testing.</p></div></div></td>
+</tr>
+<tr>
+<td align="left"><p class="table">deliveries</p></td>
+<td align="left"><div><div class="paragraph"><p>Keeps an array of all the emails sent out through the Action Mailer with delivery_method :test. Most useful
+ for unit and functional testing.</p></div></div></td>
+</tr>
+<tr>
+<td align="left"><p class="table">default_charset</p></td>
+<td align="left"><div><div class="paragraph"><p>The default charset used for the body and to encode the subject. Defaults to UTF-8. You can also
+ pick a different charset from inside a method with charset.</p></div></div></td>
+</tr>
+<tr>
+<td align="left"><p class="table">default_content_type</p></td>
+<td align="left"><div><div class="paragraph"><p>The default content type used for the main part of the message. Defaults to "text/plain". You
+ can also pick a different content type from inside a method with content_type.</p></div></div></td>
+</tr>
+<tr>
+<td align="left"><p class="table">default_mime_version</p></td>
+<td align="left"><div><div class="paragraph"><p>The default mime version used for the message. Defaults to 1.0. You
+ can also pick a different value from inside a method with mime_version.</p></div></div></td>
+</tr>
+<tr>
+<td align="left"><p class="table">default_implicit_parts_order</p></td>
+<td align="left"><div><div class="paragraph"><p>When a message is built implicitly (i.e. multiple parts are assembled from templates
+ which specify the content type in their filenames) this variable controls how the parts are ordered. Defaults to
+ ["text/html", "text/enriched", "text/plain"]. Items that appear first in the array have higher priority in the mail client
+ and appear last in the mime encoded message. You can also pick a different order from inside a method with
+ implicit_parts_order.</p></div></div></td>
+</tr>
+</tbody>
+</table>
+</div>
+<h3 id="_example_action_mailer_configuration">5.1. Example Action Mailer Configuration</h3>
+<div class="paragraph"><p>An example would be:</p></div>
+<div class="listingblock">
+<div class="content"><!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>ActionMailer<span style="color: #990000">::</span>Base<span style="color: #990000">.</span>delivery_method <span style="color: #990000">=</span> <span style="color: #990000">:</span>sendmail
+ActionMailer<span style="color: #990000">::</span>Base<span style="color: #990000">.</span>sendmail_settings <span style="color: #990000">=</span> <span style="color: #FF0000">{</span>
+ <span style="color: #990000">:</span>location <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">'/usr/sbin/sendmail'</span><span style="color: #990000">,</span>
+ <span style="color: #990000">:</span>arguments <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">'-i -t'</span>
+<span style="color: #FF0000">}</span>
+ActionMailer<span style="color: #990000">::</span>Base<span style="color: #990000">.</span>perform_deliveries <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">true</span></span>
+ActionMailer<span style="color: #990000">::</span>Base<span style="color: #990000">.</span>raise_delivery_errors <span style="color: #990000">=</span> <span style="font-weight: bold"><span style="color: #0000FF">true</span></span>
+ActionMailer<span style="color: #990000">::</span>Base<span style="color: #990000">.</span>default_charset <span style="color: #990000">=</span> <span style="color: #FF0000">"iso-8859-1"</span></tt></pre></div></div>
+<h3 id="_action_mailer_configuration_for_gmail">5.2. Action Mailer Configuration for GMail</h3>
+<div class="paragraph"><p>Instructions copied from <a href="http://http://www.fromjavatoruby.com/2008/11/actionmailer-with-gmail-must-issue.html">http://http://www.fromjavatoruby.com/2008/11/actionmailer-with-gmail-must-issue.html</a></p></div>
+<div class="paragraph"><p>First you must install the action_mailer_tls plugin from <a href="http://code.openrain.com/rails/action_mailer_tls/">http://code.openrain.com/rails/action_mailer_tls/</a>, then all you have to do is configure action mailer.</p></div>
+<div class="listingblock">
+<div class="content"><!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>ActionMailer<span style="color: #990000">::</span>Base<span style="color: #990000">.</span>smtp_settings <span style="color: #990000">=</span> <span style="color: #FF0000">{</span>
+ <span style="color: #990000">:</span>address <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"smtp.gmail.com"</span><span style="color: #990000">,</span>
+ <span style="color: #990000">:</span>port <span style="color: #990000">=&gt;</span> <span style="color: #993399">587</span><span style="color: #990000">,</span>
+ <span style="color: #990000">:</span>domain <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"domain.com"</span><span style="color: #990000">,</span>
+ <span style="color: #990000">:</span>user_name <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"user@domain.com"</span><span style="color: #990000">,</span>
+ <span style="color: #990000">:</span>password <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"password"</span><span style="color: #990000">,</span>
+ <span style="color: #990000">:</span>authentication <span style="color: #990000">=&gt;</span> <span style="color: #990000">:</span>plain
+<span style="color: #FF0000">}</span></tt></pre></div></div>
+<h3 id="_configure_action_mailer_to_recognize_haml_templates">5.3. Configure Action Mailer to recognize HAML templates</h3>
+<div class="paragraph"><p>In environment.rb, add the following line:</p></div>
+<div class="listingblock">
+<div class="content"><!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite -->
+<pre><tt>ActionMailer<span style="color: #990000">::</span>Base<span style="color: #990000">.</span>register_template_extension<span style="color: #990000">(</span><span style="color: #FF0000">'haml'</span><span style="color: #990000">)</span></tt></pre></div></div>
</div>
-<h2 id="_mailer_testing">3. Mailer Testing</h2>
+<h2 id="_mailer_testing">6. Mailer Testing</h2>
<div class="sectionbody">
<div class="paragraph"><p>Testing mailers involves 2 things. One is that the mail was queued and the other that the body contains what we expect it to contain. With that in mind, we could test our example mailer from above like so:</p></div>
<div class="listingblock">
@@ -219,11 +543,11 @@ http://www.gnu.org/software/src-highlite -->
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
<div class="paragraph"><p>What have we done? Well, we sent the email and stored the returned object in the email variable. We then ensured that it was sent (the first assert), then, in the second batch of assertion, we ensure that the email does indeed contain the values that we expect.</p></div>
</div>
-<h2 id="_epilogue">4. Epilogue</h2>
+<h2 id="_epilogue">7. Epilogue</h2>
<div class="sectionbody">
<div class="paragraph"><p>This guide presented how to create a mailer and how to test it. In reality, you may find that writing your tests before you actually write your code to be a rewarding experience. It may take some time to get used to TDD (Test Driven Development), but coding this way achieves two major benefits. Firstly, you know that the code does indeed work, because the tests fail (because there&#8217;s no code), then they pass, because the code that satisfies the tests was written. Secondly, when you start with the tests, you don&#8217;t have to make time AFTER you write the code, to write the tests, then never get around to it. The tests are already there and testing has now become part of your coding regimen.</p></div>
</div>
-<h2 id="_changelog">5. Changelog</h2>
+<h2 id="_changelog">8. Changelog</h2>
<div class="sectionbody">
<div class="paragraph"><p><a href="http://rails.lighthouseapp.com/projects/16213/tickets/25">Lighthouse ticket</a></p></div>
</div>
diff --git a/railties/doc/guides/html/active_record_basics.html b/railties/doc/guides/html/active_record_basics.html
index 7ec77781ce..6dad70a46f 100644
--- a/railties/doc/guides/html/active_record_basics.html
+++ b/railties/doc/guides/html/active_record_basics.html
@@ -303,129 +303,10 @@ cellspacing="0" cellpadding="4">
<td class="content">While these column names are optional they are in fact reserved by ActiveRecord. Steer clear of reserved keywords unless you want the extra functionality. For example, "type" is a reserved keyword used to designate a table using Single Table Inheritance. If you are not using STI, try an analogous keyword like "context", that may still accurately describe the data you are modeling.</td>
</tr></table>
</div>
-<div class="tableblock">
-<table rules="all"
-frame="hsides"
-cellspacing="0" cellpadding="4">
-<col width="285" />
-<col width="902" />
-<thead>
- <tr>
- <th align="left">
- Attribute
- </th>
- <th align="left">
- Purpose
- </th>
- </tr>
-</thead>
-<tbody valign="top">
- <tr>
- <td align="left">
- created_at / created_on
- </td>
- <td align="left">
- Rails stores the current date &amp; time to this field when creating the record.
- </td>
- </tr>
- <tr>
- <td align="left">
- updated_at / updated_on
- </td>
- <td align="left">
- Rails stores the current date &amp; time to this field when updating the record.
- </td>
- </tr>
- <tr>
- <td align="left">
- lock_version
- </td>
- <td align="left">
- Adds optimistic locking to a model <a href="http://api.rubyonrails.com/classes/ActiveRecord/Locking.html">more about optimistic locking</a>.
- </td>
- </tr>
- <tr>
- <td align="left">
- type
- </td>
- <td align="left">
- Specifies that the model uses Single Table Inheritance <a href="http://api.rubyonrails.com/classes/ActiveRecord/Base.html">more about STI</a>.
- </td>
- </tr>
- <tr>
- <td align="left">
- id
- </td>
- <td align="left">
- All models require an id. the default is name is "id" but can be changed using the "set_primary_key" or "primary_key" methods.
- </td>
- </tr>
- <tr>
- <td align="left">
- <em>table_name</em>\_count
- </td>
- <td align="left">
- Can be used to caches the number of belonging objects on the associated class.
- </td>
- </tr>
-</tbody>
-</table>
-</div>
-<div class="paragraph"><p>By default rails assumes all tables will use “id” as their primary key to identify each record. Though fortunately you won’t have explicitly declare this, Rails will automatically create that field unless you tell it not to.</p></div>
-<div class="paragraph"><p>For example suppose you created a database table called cars:</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt>mysql<span style="color: #990000">&gt;</span> <span style="font-weight: bold"><span style="color: #0000FF">CREATE</span></span> <span style="font-weight: bold"><span style="color: #0000FF">TABLE</span></span> cars <span style="color: #990000">(</span>
- id <span style="color: #009900">INT</span><span style="color: #990000">,</span>
- color <span style="color: #009900">VARCHAR</span><span style="color: #990000">(</span><span style="color: #993399">100</span><span style="color: #990000">),</span>
- doors <span style="color: #009900">INT</span><span style="color: #990000">,</span>
- horses <span style="color: #009900">INT</span><span style="color: #990000">,</span>
- model <span style="color: #009900">VARCHAR</span><span style="color: #990000">(</span><span style="color: #993399">100</span><span style="color: #990000">)</span>
- <span style="color: #990000">);</span></tt></pre></div></div>
-<div class="paragraph"><p>Now you created a class named Car, which is to represent an instance of a record from your table.</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">class</span></span> Car
-<span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
-<div class="paragraph"><p>As you might expect without defining the explicit mappings between your class and the table it is impossible for Rails or any other program to correctly map those relationships.</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="color: #990000">&gt;&gt;</span> c <span style="color: #990000">=</span> Car<span style="color: #990000">.</span>new
-<span style="color: #990000">=&gt;</span> <span style="font-style: italic"><span style="color: #9A1900">#&lt;Class:0x11e1e90&gt;</span></span>
-<span style="color: #990000">&gt;&gt;</span> c<span style="color: #990000">.</span>doors
-NoMethodError<span style="color: #990000">:</span> undefined method `doors' <span style="font-weight: bold"><span style="color: #0000FF">for</span></span> <span style="font-style: italic"><span style="color: #9A1900">#&lt;Class:0x11e1e90&gt;</span></span>
- from <span style="color: #990000">(</span>irb<span style="color: #990000">):</span><span style="color: #993399">2</span></tt></pre></div></div>
-<div class="paragraph"><p>Now you could define a door methods to write and read data to and from the database. In a nutshell this is what ActiveRecord does. According to the Rails API:
-“Active Record objects don‘t specify their attributes directly, but rather infer them from the table definition with which they‘re linked. Adding, removing, and changing attributes and their type is done directly in the database. Any change is instantly reflected in the Active Record objects. The mapping that binds a given Active Record class to a certain database table will happen automatically in most common cases, but can be overwritten for the uncommon ones.”
-Lets try our Car class again, this time inheriting from ActiveRecord.</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">class</span></span> Car <span style="color: #990000">&lt;</span> ActiveRecord<span style="color: #990000">::</span>Base
-<span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
-<div class="paragraph"><p>Now if we try to access an attribute of the table ActiveRecord automatically handles the mappings for us, as you can see in the following example.</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="color: #990000">&gt;&gt;</span> c <span style="color: #990000">=</span> Car<span style="color: #990000">.</span>new
-<span style="color: #990000">=&gt;</span> <span style="font-style: italic"><span style="color: #9A1900">#&lt;Car id: nil, doors: nil, color: nil, horses: nil, model: nil&gt;</span></span>
-<span style="color: #990000">&gt;&gt;</span> c<span style="color: #990000">.</span>doors
-<span style="color: #990000">=&gt;</span> <span style="font-weight: bold"><span style="color: #0000FF">nil</span></span></tt></pre></div></div>
-<div class="paragraph"><p>Rails further extends this model by giving each ActiveRecord a way of describing the variety of ways records are associated with one another. We will touch on some of these associations later in the guide but I encourage readers who are interested to read the guide to ActiveRecord associations for an in-depth explanation of the variety of ways rails can model associations.
-- Associations between objects controlled by meta-programming macros.</p></div>
+<div class="literalblock">
+<div class="content">
+<pre><tt>== STOPED HERE</tt></pre>
+</div></div>
</div>
<h2 id="_philosophical_approaches_amp_common_conventions">7. Philosophical Approaches &amp; Common Conventions</h2>
<div class="sectionbody">