Skip to content
Browse files

Regenerate guides html

  • Loading branch information...
1 parent 9f097e3 commit cfddbcd8e7a1d965c937c04bbf6112b60d1bb962 @lifo lifo committed Jan 31, 2009
View
237 railties/doc/guides/html/action_mailer_basics.html
@@ -47,8 +47,12 @@ <h2 id="site_title_tagline">Sustainable productivity for web-application develop
<li><a href="#_action_mailer_layouts">Action Mailer Layouts</a></li>
+ <li><a href="#_generating_url_8217_s_in_action_mailer_views">Generating URL&#8217;s in Action Mailer views</a></li>
+
<li><a href="#_sending_multipart_emails">Sending multipart emails</a></li>
+ <li><a href="#_sending_emails_with_attachments">Sending emails with attachments</a></li>
+
</ul>
</li>
<li>
@@ -75,29 +79,26 @@ <h2 id="site_title_tagline">Sustainable productivity for web-application develop
<li>
<a href="#_epilogue">Epilogue</a>
</li>
- <li>
- <a href="#_changelog">Changelog</a>
- </li>
</ol>
</div>
<div id="content">
<h1>Action Mailer Basics</h1>
<div id="preamble">
<div class="sectionbody">
-<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 class="paragraph"><p>This guide should provide you with all you need to get started in sending and receiving emails from/to your application, and many internals of the ActionMailer class. It will also cover how to test your mailers.</p></div>
</div>
</div>
<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>
+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="_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="_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>
+<h4 id="_create_the_mailer">2.1.1. Create the mailer:</h4>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 2.9
by Lorenzo Bettini
@@ -111,7 +112,8 @@ <h4 id="_1_create_the_mailer">2.1.1. 1. Create the mailer:</h4>
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>
-<h4 id="_2_edit_the_model">2.1.2. 2. Edit the model:</h4>
+<h4 id="_edit_the_model">2.1.2. Edit the model:</h4>
+<div class="paragraph"><p>If you look at app/models/user_mailer.rb, you will see:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 2.9
by Lorenzo Bettini
@@ -138,14 +140,40 @@ <h4 id="_2_edit_the_model">2.1.2. 2. Edit the model:</h4>
<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>So what do we have here?
-recipients: who the recipients are, put in an array for multiple, ie, @recipients = ["user1@example.com", "user2@example.com"]
-from: Who the email will appear to come from in the recipients' mailbox
-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>So what do we have here?</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">recipients</p></td>
+<td align="left"><p class="table">who the recipients are, put in an array for multiple, ie, @recipients = ["user1@example.com", "user2@example.com"]</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">from</p></td>
+<td align="left"><p class="table">Who the email will appear to come from in the recipients' mailbox</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">subject</p></td>
+<td align="left"><p class="table">The subject of the email</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">sent_on</p></td>
+<td align="left"><p class="table">Timestamp for the email</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">content_type</p></td>
+<td align="left"><p class="table">The content type, by default is text/plain</p></td>
+</tr>
+</tbody>
+</table>
+</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>
-<h4 id="_3_create_the_mailer_view">2.1.3. 3. Create the mailer view</h4>
+<h4 id="_create_the_mailer_view">2.1.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">
@@ -160,17 +188,17 @@ <h4 id="_3_create_the_mailer_view">2.1.3. 3. Create the mailer view</h4>
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/head&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;h1&gt;</span></span>Welcome to example.com, &lt;%= @user.first_name %&gt;<span style="font-weight: bold"><span style="color: #0000FF">&lt;/h1&gt;</span></span>
-
<span style="font-weight: bold"><span style="color: #0000FF">&lt;p&gt;</span></span>
You have successfully signed up to example.com, and your username is: &lt;%= @user.login %&gt;.<span style="font-weight: bold"><span style="color: #0000FF">&lt;br/&gt;</span></span>
To login to the site, just follow this link: &lt;%= @url %&gt;.
<span style="font-weight: bold"><span style="color: #0000FF">&lt;/p&gt;</span></span>
<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>
-<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>
+<h4 id="_wire_it_up_so_that_the_system_sends_the_email_when_a_user_signs_up">2.1.4. Wire it up so that the system sends the email when a user signs up</h4>
+<div class="paragraph"><p>There are 3 ways 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>Let&#8217;s see how we would go about wiring it up using an observer:</p></div>
+<div class="paragraph"><p>In config/environment.rb:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 2.9
by Lorenzo Bettini
@@ -185,7 +213,7 @@ <h4 id="_4_wire_it_up_so_that_the_system_sends_the_email_when_a_user_signs_up">2
config<span style="color: #990000">.</span>active_record<span style="color: #990000">.</span>observers <span style="color: #990000">=</span> <span style="color: #990000">:</span>user_observer
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
-<div class="paragraph"><p></p></div>
+<div class="paragraph"><p>There was a bit of a debate on where to put observers. Some people put them in app/models, but a cleaner method may be to create an app/observers folder to store all observers, and add that to your load path. Open config/environment.rb and make it look like:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 2.9
by Lorenzo Bettini
@@ -202,7 +230,8 @@ <h4 id="_4_wire_it_up_so_that_the_system_sends_the_email_when_a_user_signs_up">2
config<span style="color: #990000">.</span>active_record<span style="color: #990000">.</span>observers <span style="color: #990000">=</span> <span style="color: #990000">:</span>user_observer
<span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
-<div class="paragraph"><p>ALMOST THERE :) Now all we need is that danged observer, and we&#8217;re done:</p></div>
+<div class="paragraph"><p>ALMOST THERE :) Now all we need is that danged observer, and we&#8217;re done:
+Create a file called user_observer in app/models or app/observers depending on where you stored it, and make it look like:</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 2.9
by Lorenzo Bettini
@@ -237,7 +266,7 @@ <h3 id="_action_mailer_and_dynamic_deliver_methods">2.2. Action Mailer and dynam
<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>
+<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"
@@ -330,7 +359,7 @@ <h3 id="_mailer_views">2.4. Mailer Views</h3>
<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="paragraph"><p>Just like controller views, you can also have mailer layouts. The layout name needs to 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
@@ -342,14 +371,170 @@ <h3 id="_action_mailer_layouts">2.5. Action Mailer Layouts</h3>
<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>
+<h3 id="_generating_url_8217_s_in_action_mailer_views">2.6. Generating URL&#8217;s in Action Mailer views</h3>
+<div class="paragraph"><p>URLs can be generated in mailer views using url_for or named routes.
+Unlike controllers from Action Pack, the mailer instance doesn&#8217;t have any context about the incoming request, so you&#8217;ll need to provide all of the details needed to generate a URL.</p></div>
+<div class="paragraph"><p>When using url_for you&#8217;ll need to provide the :host, :controller, and :action:</p></div>
+<div class="literalblock">
+<div class="content">
+<pre><tt>&lt;%= url_for(:host =&gt; "example.com", :controller =&gt; "welcome", :action =&gt; "greeting") %&gt;</tt></pre>
+</div></div>
+<div class="paragraph"><p>When using named routes you only need to supply the :host:</p></div>
+<div class="literalblock">
+<div class="content">
+<pre><tt>&lt;%= users_url(:host =&gt; "example.com") %&gt;</tt></pre>
+</div></div>
+<div class="paragraph"><p>You will want to avoid using the name_of_route_path form of named routes because it doesn&#8217;t make sense to generate relative URLs in email messages. The reason that it doesn&#8217;t make sense is because the email is opened on a mail client outside of your environment. Since the email is not being served by your server, a URL like "/users/show/1", will have no context. In order for the email client to properly link to a URL on your server it needs something like "http://yourserver.com/users/show/1".</p></div>
+<div class="paragraph"><p>It is also possible to set a default host that will be used in all mailers by setting the :host option in
+the ActionMailer::Base.default_url_options hash as follows:</p></div>
+<div class="literalblock">
+<div class="content">
+<pre><tt>ActionMailer::Base.default_url_options[:host] = "example.com"</tt></pre>
+</div></div>
+<div class="paragraph"><p>This can also be set as a configuration option in config/environment.rb:</p></div>
+<div class="literalblock">
+<div class="content">
+<pre><tt>config.action_mailer.default_url_options = { :host =&gt; "example.com" }</tt></pre>
+</div></div>
+<div class="paragraph"><p>If you do decide to set a default :host for your mailers you will want to use the :only_path =&gt; false option when using url_for. This will ensure that absolute URLs are generated because the url_for view helper will, by default, generate relative URLs when a :host option isn&#8217;t explicitly provided.</p></div>
+<h3 id="_sending_multipart_emails">2.7. Sending multipart emails</h3>
+<div class="paragraph"><p>Action Mailer will automatically send multipart emails if you have different templates for the same action. So, for our UserMailer example, if you have welcome_email.txt.erb and welcome_email.html.erb in app/views/user_mailer, Action Mailer will automatically send a multipart email with the html and text versions setup as different parts.</p></div>
+<div class="paragraph"><p>To explicitly specify multipart messages, you can 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_address
+ subject <span style="color: #FF0000">"New account information"</span>
+ from <span style="color: #FF0000">"system@example.com"</span>
+ content_type <span style="color: #FF0000">"multipart/alternative"</span>
+
+ part <span style="color: #990000">:</span>content_type <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"text/html"</span><span style="color: #990000">,</span>
+ <span style="color: #990000">:</span>body <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"&lt;p&gt;html content, can also be the name of an action that you call&lt;p&gt;"</span>
+
+ part <span style="color: #FF0000">"text/plain"</span> <span style="font-weight: bold"><span style="color: #0000FF">do</span></span> <span style="color: #990000">|</span>p<span style="color: #990000">|</span>
+ p<span style="color: #990000">.</span>body <span style="color: #990000">=</span> <span style="color: #FF0000">"text content, can also be the name of an action that you call"</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>
+<h3 id="_sending_emails_with_attachments">2.8. Sending emails with attachments</h3>
+<div class="paragraph"><p>Attachments can be added by using the attachment method:</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_address
+ subject <span style="color: #FF0000">"New account information"</span>
+ from <span style="color: #FF0000">"system@example.com"</span>
+ content_type <span style="color: #FF0000">"multipart/alternative"</span>
+
+ attachment <span style="color: #990000">:</span>content_type <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"image/jpeg"</span><span style="color: #990000">,</span>
+ <span style="color: #990000">:</span>body <span style="color: #990000">=&gt;</span> File<span style="color: #990000">.</span>read<span style="color: #990000">(</span><span style="color: #FF0000">"an-image.jpg"</span><span style="color: #990000">)</span>
+
+ attachment <span style="color: #FF0000">"application/pdf"</span> <span style="font-weight: bold"><span style="color: #0000FF">do</span></span> <span style="color: #990000">|</span>a<span style="color: #990000">|</span>
+ a<span style="color: #990000">.</span>body <span style="color: #990000">=</span> generate_your_pdf_here<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>
<h2 id="_receiving_emails">3. Receiving Emails</h2>
<div class="sectionbody">
+<div class="paragraph"><p>Receiving and parsing emails with Action Mailer can be a rather complex endeavour. Before your email reaches your Rails app, you would have had to configure your system to somehow forward emails to your app, which needs to be listening for that.
+So, to receive emails in your Rails app you&#8217;ll need:</p></div>
+<div class="olist arabic"><ol class="arabic">
+<li>
+<p>
+Configure your email server to forward emails from the address(es) you would like your app to receive to /path/to/app/script/runner 'UserMailer.receive(STDIN.read)'
+</p>
+</li>
+<li>
+<p>
+Implement a receive method in your mailer
+</p>
+</li>
+</ol></div>
+<div class="paragraph"><p>Once a method called receive is defined in any mailer, Action Mailer will parse the raw incoming email into an email object, decode it, instantiate a new mailer, and pass the email object to the mailer object‘s receive method. Here&#8217;s an 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="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> receive<span style="color: #990000">(</span>email<span style="color: #990000">)</span>
+ page <span style="color: #990000">=</span> Page<span style="color: #990000">.</span>find_by_address<span style="color: #990000">(</span>email<span style="color: #990000">.</span>to<span style="color: #990000">.</span>first<span style="color: #990000">)</span>
+ page<span style="color: #990000">.</span>emails<span style="color: #990000">.</span>create<span style="color: #990000">(</span>
+ <span style="color: #990000">:</span>subject <span style="color: #990000">=&gt;</span> email<span style="color: #990000">.</span>subject<span style="color: #990000">,</span>
+ <span style="color: #990000">:</span>body <span style="color: #990000">=&gt;</span> email<span style="color: #990000">.</span>body
+ <span style="color: #990000">)</span>
+
+ <span style="font-weight: bold"><span style="color: #0000FF">if</span></span> email<span style="color: #990000">.</span>has_attachments?
+ <span style="font-weight: bold"><span style="color: #0000FF">for</span></span> attachment <span style="font-weight: bold"><span style="color: #0000FF">in</span></span> email<span style="color: #990000">.</span>attachments
+ page<span style="color: #990000">.</span>attachments<span style="color: #990000">.</span>create<span style="color: #990000">(</span><span style="color: #FF0000">{</span>
+ <span style="color: #990000">:</span>file <span style="color: #990000">=&gt;</span> attachment<span style="color: #990000">,</span>
+ <span style="color: #990000">:</span>description <span style="color: #990000">=&gt;</span> email<span style="color: #990000">.</span>subject
+ <span style="color: #FF0000">}</span><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>
+
+
+<span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
</div>
<h2 id="_using_action_mailer_helpers">4. Using Action Mailer Helpers</h2>
<div class="sectionbody">
+<div class="paragraph"><p>Action Mailer classes have 4 helper methods available to them:</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">add_template_helper(helper_module)</p></td>
+<td align="left"><p class="table">Makes all the (instance) methods in the helper module available to templates rendered through this controller.</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">helper(*args, &amp;block)</p></td>
+<td align="left"><p class="table">Declare a helper:
+ helper :foo
+requires <em>foo_helper</em> and includes FooHelper in the template class.
+ helper FooHelper
+includes FooHelper in the template class.
+evaluates the block in the template class, adding method foo.
+ helper(:three, BlindHelper) { def mice() <em>mice</em> end }
+does all three.</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">helper_method</p></td>
+<td align="left"><p class="table">Declare a controller method as a helper. For example,
+ helper_method :link_to
+ def link_to(name, options) ... end
+makes the link_to controller method available in the view.</p></td>
+</tr>
+<tr>
+<td align="left"><p class="table">helper_attr</p></td>
+<td align="left"><p class="table">Declare a controller attribute as a helper. For example,
+ helper_attr :name
+ attr_accessor :name
+makes the name and name= controller methods available in the view.
+The is a convenience wrapper for helper_method.</p></td>
+</tr>
+</tbody>
+</table>
+</div>
</div>
<h2 id="_action_mailer_configuration">5. Action Mailer Configuration</h2>
<div class="sectionbody">
@@ -547,10 +732,6 @@ <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">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>
</div>
</div>
View
6 railties/doc/guides/html/form_helpers.html
@@ -197,7 +197,7 @@ <h2 id="_dealing_with_basic_forms">1. Dealing With Basic Forms</h2>
</div>
<h3 id="_a_generic_search_form">1.1. A Generic search form</h3>
<div class="paragraph"><p>Probably the most minimal form often seen on the web is a search form with a single text input for search terms. This form consists of:</p></div>
-<div class="olist"><ol>
+<div class="olist arabic"><ol class="arabic">
<li>
<p>
a form element with "GET" method,
@@ -420,7 +420,7 @@ <h3 id="_binding_a_form_to_an_object">2.2. Binding a form to an object</h3>
&lt;% end %&gt;</tt></pre>
</div></div>
<div class="paragraph"><p>There are a few things to note here:</p></div>
-<div class="olist"><ol>
+<div class="olist arabic"><ol class="arabic">
<li>
<p>
<tt>:article</tt> is the name of the model and <tt>@article</tt> is the actual object being edited.
@@ -662,7 +662,7 @@ <h3 id="_time_zone_and_country_select">3.4. Time zone and country select</h3>
<h2 id="_using_date_and_time_form_helpers">4. Using Date and Time Form Helpers</h2>
<div class="sectionbody">
<div class="paragraph"><p>The date and time helpers differ from all the other form helpers in two important respects:</p></div>
-<div class="olist"><ol>
+<div class="olist arabic"><ol class="arabic">
<li>
<p>
Dates and times are not representable by a single input element. Instead you have several, one for each component (year, month, day etc.) and so there is no single value in your <tt>params</tt> hash with your date or time.
View
2 railties/doc/guides/html/security.html
@@ -326,7 +326,7 @@ <h3 id="_session_fixation">2.7. Session fixation</h3>
</div>
</div>
<div class="paragraph"><p>This attack focuses on fixing a user&#8217;s session id known to the attacker, and forcing the user&#8217;s browser into using this id. It is therefore not necessary for the attacker to steal the session id afterwards. Here is how this attack works:</p></div>
-<div class="olist"><ol>
+<div class="olist arabic"><ol class="arabic">
<li>
<p>
The attacker creates a valid session id: He loads the login page of the web application where he wants to fix the session, and takes the session id in the cookie from the response (see number 1 and 2 in the image).

0 comments on commit cfddbcd

Please sign in to comment.
Something went wrong with that request. Please try again.