<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>railties/doc/guides/asciidoc.conf</filename>
    </added>
    <added>
      <filename>railties/doc/guides/html/i18n.html</filename>
    </added>
    <added>
      <filename>railties/doc/guides/source/creating_plugins/gems.txt</filename>
    </added>
    <added>
      <filename>railties/doc/guides/source/creating_plugins/generator_commands.txt</filename>
    </added>
    <added>
      <filename>railties/doc/guides/source/creating_plugins/generators.txt</filename>
    </added>
    <added>
      <filename>railties/doc/guides/source/creating_plugins/migrations.txt</filename>
    </added>
    <added>
      <filename>railties/doc/guides/source/creating_plugins/rdoc.txt</filename>
    </added>
    <added>
      <filename>railties/doc/guides/source/creating_plugins/routes.txt</filename>
    </added>
    <added>
      <filename>railties/doc/guides/source/creating_plugins/setup.txt</filename>
    </added>
    <added>
      <filename>railties/doc/guides/source/creating_plugins/tasks.txt</filename>
    </added>
    <added>
      <filename>railties/doc/guides/source/creating_plugins/tests.txt</filename>
    </added>
    <added>
      <filename>railties/doc/guides/source/i18n.txt</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -10,7 +10,7 @@ Action Pack implements these actions as public methods on Action Controllers
 and uses Action Views to implement the template rendering. Action Controllers
 are then responsible for handling all the actions relating to a certain part
 of an application. This grouping usually consists of actions for lists and for
-CRUDs revolving around a single (or a few) model objects. So ContactController
+CRUDs revolving around a single (or a few) model objects. So ContactsController
 would be responsible for listing contacts, creating, deleting, and updating
 contacts. A WeblogController could be responsible for both posts and comments.
 
@@ -33,7 +33,7 @@ A short rundown of the major features:
 * Actions grouped in controller as methods instead of separate command objects
   and can therefore share helper methods
 
-    BlogController &lt; ActionController::Base
+    CustomersController &lt; ActionController::Base
       def show
         @customer = find_customer
       end
@@ -42,7 +42,7 @@ A short rundown of the major features:
         @customer = find_customer
         @customer.attributes = params[:customer]
         @customer.save ? 
-          redirect_to(:action =&gt; &quot;display&quot;) : 
+          redirect_to(:action =&gt; &quot;show&quot;) :
           render(:action =&gt; &quot;edit&quot;)
       end
       
@@ -59,7 +59,7 @@ A short rundown of the major features:
       Title: &lt;%= post.title %&gt;
     &lt;% end %&gt;
 
-    All post titles: &lt;%= @post.collect{ |p| p.title }.join &quot;, &quot; %&gt;
+    All post titles: &lt;%= @posts.collect{ |p| p.title }.join &quot;, &quot; %&gt;
 
     &lt;% unless @person.is_client? %&gt;
       Not for clients to see...
@@ -123,7 +123,7 @@ A short rundown of the major features:
     &lt;%= text_field &quot;post&quot;, &quot;title&quot;, &quot;size&quot; =&gt; 30 %&gt;
     &lt;%= html_date_select(Date.today) %&gt;
     &lt;%= link_to &quot;New post&quot;, :controller =&gt; &quot;post&quot;, :action =&gt; &quot;new&quot; %&gt;
-    &lt;%= truncate(post.title, 25) %&gt;
+    &lt;%= truncate(post.title, :length =&gt; 25) %&gt;
  
   {Learn more}[link:classes/ActionView/Helpers.html]
 
@@ -177,21 +177,6 @@ A short rundown of the major features:
   {Learn more}[link:classes/ActionView/Helpers/JavaScriptHelper.html]
 
 
-* Pagination for navigating lists of results
-
-    # controller
-    def list
-      @pages, @people =
-        paginate :people, :order =&gt; 'last_name, first_name'
-    end
-
-    # view
-    &lt;%= link_to &quot;Previous page&quot;, { :page =&gt; @pages.current.previous } if @pages.current.previous %&gt;
-    &lt;%= link_to &quot;Next page&quot;, { :page =&gt; @pages.current.next } if @pages.current.next %&gt;
-
-  {Learn more}[link:classes/ActionController/Pagination.html]
-
-
 * Easy testing of both controller and rendered template through ActionController::TestCase
 
     class LoginControllerTest &lt; ActionController::TestCase
@@ -215,11 +200,11 @@ A short rundown of the major features:
     If Active Record is used as the model, you'll have the database debugging
     as well:
 
-    Processing WeblogController#create (for 127.0.0.1 at Sat Jun 19 14:04:23)
-    Params: {&quot;controller&quot;=&gt;&quot;weblog&quot;, &quot;action&quot;=&gt;&quot;create&quot;,  
+    Processing PostsController#create (for 127.0.0.1 at Sat Jun 19 14:04:23)
+    Params: {&quot;controller&quot;=&gt;&quot;posts&quot;, &quot;action&quot;=&gt;&quot;create&quot;,
              &quot;post&quot;=&gt;{&quot;title&quot;=&gt;&quot;this is good&quot;} }
     SQL (0.000627) INSERT INTO posts (title) VALUES('this is good')
-    Redirected to http://test/weblog/display/5
+    Redirected to http://example.com/posts/5
     Completed in 0.221764 (4 reqs/sec) | DB: 0.059920 (27%)
 
     You specify a logger through a class method, such as:
@@ -256,30 +241,6 @@ A short rundown of the major features:
   {Learn more}[link:classes/ActionController/Caching.html]
 
 
-* Component requests from one controller to another
-
-    class WeblogController &lt; ActionController::Base
-      # Performs a method and then lets hello_world output its render
-      def delegate_action
-        do_other_stuff_before_hello_world
-        render_component :controller =&gt; &quot;greeter&quot;,  :action =&gt; &quot;hello_world&quot;
-      end
-    end
-  
-    class GreeterController &lt; ActionController::Base
-      def hello_world
-        render_text &quot;Hello World!&quot;
-      end
-    end
-  
-    The same can be done in a view to do a partial rendering:
-  
-      Let's see a greeting:
-      &lt;%= render_component :controller =&gt; &quot;greeter&quot;, :action =&gt; &quot;hello_world&quot; %&gt;
-
-  {Learn more}[link:classes/ActionController/Components.html]
-  
-
 * Powerful debugging mechanism for local requests
 
     All exceptions raised on actions performed on the request of a local user
@@ -336,7 +297,7 @@ A short rundown of the major features:
     class WeblogController &lt; ActionController::Base
       def create
         post = Post.create(params[:post])
-        redirect_to :action =&gt; &quot;display&quot;, :id =&gt; post.id
+        redirect_to :action =&gt; &quot;show&quot;, :id =&gt; post.id
       end
     end
 
@@ -362,7 +323,7 @@ methods:
       @posts = Post.find(:all)
     end
     
-    def display
+    def show
       @post = Post.find(params[:id])
     end
     
@@ -372,7 +333,7 @@ methods:
     
     def create
       @post = Post.create(params[:post])
-      redirect_to :action =&gt; &quot;display&quot;, :id =&gt; @post.id
+      redirect_to :action =&gt; &quot;show&quot;, :id =&gt; @post.id
     end
   end
 
@@ -385,47 +346,32 @@ request from the web-server (like to be Apache).
 
 And the templates look like this:
 
-  weblog/layout.erb:
+  weblog/layout.html.erb:
     &lt;html&gt;&lt;body&gt;
     &lt;%= yield %&gt;
     &lt;/body&gt;&lt;/html&gt;
 
-  weblog/index.erb:
+  weblog/index.html.erb:
     &lt;% for post in @posts %&gt;
-      &lt;p&gt;&lt;%= link_to(post.title, :action =&gt; &quot;display&quot;, :id =&gt; post.id %&gt;&lt;/p&gt;
+      &lt;p&gt;&lt;%= link_to(post.title, :action =&gt; &quot;show&quot;, :id =&gt; post.id) %&gt;&lt;/p&gt;
     &lt;% end %&gt;
 
-  weblog/display.erb:
+  weblog/show.html.erb:
     &lt;p&gt;
-      &lt;b&gt;&lt;%= post.title %&gt;&lt;/b&gt;&lt;br/&gt;
-      &lt;b&gt;&lt;%= post.content %&gt;&lt;/b&gt;
+      &lt;b&gt;&lt;%= @post.title %&gt;&lt;/b&gt;&lt;br/&gt;
+      &lt;b&gt;&lt;%= @post.content %&gt;&lt;/b&gt;
     &lt;/p&gt;
 
-  weblog/new.erb:
+  weblog/new.html.erb:
     &lt;%= form &quot;post&quot; %&gt;
   
 This simple setup will list all the posts in the system on the index page,
 which is called by accessing /weblog/. It uses the form builder for the Active
 Record model to make the new screen, which in turn hands everything over to
 the create action (that's the default target for the form builder when given a
-new model). After creating the post, it'll redirect to the display page using
-an URL such as /weblog/display/5 (where 5 is the id of the post).
-
-
-== Examples
-
-Action Pack ships with three examples that all demonstrate an increasingly
-detailed view of the possibilities. First is blog_controller that is just a
-single file for the whole MVC (but still split into separate parts). Second is
-the debate_controller that uses separate template files and multiple screens.
-Third is the address_book_controller that uses the layout feature to separate
-template casing from content.
-
-Please note that you might need to change the &quot;shebang&quot; line to 
-#!/usr/local/env ruby, if your Ruby is not placed in /usr/local/bin/ruby
+new model). After creating the post, it'll redirect to the show page using
+an URL such as /weblog/5 (where 5 is the id of the post).
 
-Also note that these examples are all for demonstrating using Action Pack on
-its own. Not for when it's used inside of Rails.
 
 == Download
 
@@ -460,4 +406,4 @@ And as Jim from Rake says:
 
    Feel free to submit commits or feature requests.  If you send a patch,
    remember to update the corresponding unit tests.  If fact, I prefer
-   new feature to be submitted in the form of new unit tests.
\ No newline at end of file
+   new feature to be submitted in the form of new unit tests.</diff>
      <filename>actionpack/README</filename>
    </modified>
    <modified>
      <diff>@@ -83,15 +83,23 @@ module ActionController #:nodoc:
         end
       end
 
-      # Name can take one of three forms:
-      # * String: This would normally take the form of a path like &quot;pages/45/notes&quot;
-      # * Hash: Is treated as an implicit call to url_for, like { :controller =&gt; &quot;pages&quot;, :action =&gt; &quot;notes&quot;, :id =&gt; 45 }
-      # * Regexp: Will destroy all the matched fragments, example:
-      #     %r{pages/\d*/notes}
-      #   Ensure you do not specify start and finish in the regex (^$) because
-      #   the actual filename matched looks like ./cache/filename/path.cache
-      #   Regexp expiration is only supported on caches that can iterate over
-      #   all keys (unlike memcached).
+      # Removes fragments from the cache.
+      #
+      # +key+ can take one of three forms:
+      # * String - This would normally take the form of a path, like
+      #   &lt;tt&gt;&quot;pages/45/notes&quot;&lt;/tt&gt;.
+      # * Hash - Treated as an implicit call to +url_for+, like
+      #   &lt;tt&gt;{:controller =&gt; &quot;pages&quot;, :action =&gt; &quot;notes&quot;, :id =&gt; 45}&lt;/tt&gt;
+      # * Regexp - Will remove any fragment that matches, so
+      #   &lt;tt&gt;%r{pages/\d*/notes}&lt;/tt&gt; might remove all notes. Make sure you
+      #   don't use anchors in the regex (&lt;tt&gt;^&lt;/tt&gt; or &lt;tt&gt;$&lt;/tt&gt;) because
+      #   the actual filename matched looks like
+      #   &lt;tt&gt;./cache/filename/path.cache&lt;/tt&gt;. Note: Regexp expiration is
+      #   only supported on caches that can iterate over all keys (unlike
+      #   memcached).
+      #
+      # +options+ is passed through to the cache store's &lt;tt&gt;delete&lt;/tt&gt;
+      # method (or &lt;tt&gt;delete_matched&lt;/tt&gt;, for Regexp keys.)
       def expire_fragment(key, options = nil)
         return unless cache_configured?
 </diff>
      <filename>actionpack/lib/action_controller/caching/fragments.rb</filename>
    </modified>
    <modified>
      <diff>@@ -33,28 +33,26 @@ module ActionController #:nodoc:
     #
     # Additionally, you can expire caches using Sweepers that act on changes in the model to determine when a cache is supposed to be
     # expired.
-    #
-    # == Setting the cache directory
-    #
-    # The cache directory should be the document root for the web server and is set using &lt;tt&gt;Base.page_cache_directory = &quot;/document/root&quot;&lt;/tt&gt;.
-    # For Rails, this directory has already been set to Rails.public_path (which is usually set to &lt;tt&gt;RAILS_ROOT + &quot;/public&quot;&lt;/tt&gt;). Changing
-    # this setting can be useful to avoid naming conflicts with files in &lt;tt&gt;public/&lt;/tt&gt;, but doing so will likely require configuring your
-    # web server to look in the new location for cached files.
-    #
-    # == Setting the cache extension
-    #
-    # Most Rails requests do not have an extension, such as &lt;tt&gt;/weblog/new&lt;/tt&gt;. In these cases, the page caching mechanism will add one in
-    # order to make it easy for the cached files to be picked up properly by the web server. By default, this cache extension is &lt;tt&gt;.html&lt;/tt&gt;.
-    # If you want something else, like &lt;tt&gt;.php&lt;/tt&gt; or &lt;tt&gt;.shtml&lt;/tt&gt;, just set Base.page_cache_extension. In cases where a request already has an
-    # extension, such as &lt;tt&gt;.xml&lt;/tt&gt; or &lt;tt&gt;.rss&lt;/tt&gt;, page caching will not add an extension. This allows it to work well with RESTful apps.
     module Pages
       def self.included(base) #:nodoc:
         base.extend(ClassMethods)
         base.class_eval do
           @@page_cache_directory = defined?(Rails.public_path) ? Rails.public_path : &quot;&quot;
+          ##
+          # :singleton-method:
+          # The cache directory should be the document root for the web server and is set using &lt;tt&gt;Base.page_cache_directory = &quot;/document/root&quot;&lt;/tt&gt;.
+          # For Rails, this directory has already been set to Rails.public_path (which is usually set to &lt;tt&gt;RAILS_ROOT + &quot;/public&quot;&lt;/tt&gt;). Changing
+          # this setting can be useful to avoid naming conflicts with files in &lt;tt&gt;public/&lt;/tt&gt;, but doing so will likely require configuring your
+          # web server to look in the new location for cached files.
           cattr_accessor :page_cache_directory
 
           @@page_cache_extension = '.html'
+          ##
+          # :singleton-method:
+          # Most Rails requests do not have an extension, such as &lt;tt&gt;/weblog/new&lt;/tt&gt;. In these cases, the page caching mechanism will add one in
+          # order to make it easy for the cached files to be picked up properly by the web server. By default, this cache extension is &lt;tt&gt;.html&lt;/tt&gt;.
+          # If you want something else, like &lt;tt&gt;.php&lt;/tt&gt; or &lt;tt&gt;.shtml&lt;/tt&gt;, just set Base.page_cache_extension. In cases where a request already has an
+          # extension, such as &lt;tt&gt;.xml&lt;/tt&gt; or &lt;tt&gt;.rss&lt;/tt&gt;, page caching will not add an extension. This allows it to work well with RESTful apps.
           cattr_accessor :page_cache_extension
         end
       end</diff>
      <filename>actionpack/lib/action_controller/caching/pages.rb</filename>
    </modified>
    <modified>
      <diff>@@ -283,7 +283,12 @@ module ActionController
     # * &lt;tt&gt;:new&lt;/tt&gt; - Same as &lt;tt&gt;:collection&lt;/tt&gt;, but for actions that operate on the new \resource action.
     # * &lt;tt&gt;:controller&lt;/tt&gt; - Specify the controller name for the routes.
     # * &lt;tt&gt;:singular&lt;/tt&gt; - Specify the singular name used in the member routes.
-    # * &lt;tt&gt;:requirements&lt;/tt&gt; - Set custom routing parameter requirements.
+    # * &lt;tt&gt;:requirements&lt;/tt&gt; - Set custom routing parameter requirements; this is a hash of either 
+    #     regular expressions (which must match for the route to match) or extra parameters. For example:
+    #
+    #       map.resource :profile, :path_prefix =&gt; ':name', :requirements =&gt; { :name =&gt; /[a-zA-Z]+/, :extra =&gt; 'value' }
+    #
+    #     will only match if the first part is alphabetic, and will pass the parameter :extra to the controller.
     # * &lt;tt&gt;:conditions&lt;/tt&gt; - Specify custom routing recognition conditions.  \Resources sets the &lt;tt&gt;:method&lt;/tt&gt; value for the method-specific routes.
     # * &lt;tt&gt;:as&lt;/tt&gt; - Specify a different \resource name to use in the URL path. For example:
     #     # products_path == '/productos'</diff>
      <filename>actionpack/lib/action_controller/resources.rb</filename>
    </modified>
    <modified>
      <diff>@@ -83,9 +83,11 @@ module ActionController
   # This sets up +blog+ as the default controller if no other is specified.
   # This means visiting '/' would invoke the blog controller.
   #
-  # More formally, you can define defaults in a route with the &lt;tt&gt;:defaults&lt;/tt&gt; key.
+  # More formally, you can include arbitrary parameters in the route, thus:
   #
-  #   map.connect ':controller/:action/:id', :action =&gt; 'show', :defaults =&gt; { :page =&gt; 'Dashboard' }
+  #   map.connect ':controller/:action/:id', :action =&gt; 'show', :page =&gt; 'Dashboard'
+  #
+  # This will pass the :page parameter to all incoming requests that match this route.
   #
   # Note: The default routes, as provided by the Rails generator, make all actions in every
   # controller accessible via GET requests. You should consider removing them or commenting</diff>
      <filename>actionpack/lib/action_controller/routing.rb</filename>
    </modified>
    <modified>
      <diff>@@ -56,6 +56,8 @@ class CGI
     class ActiveRecordStore
       # The default Active Record class.
       class Session &lt; ActiveRecord::Base
+        ##
+        # :singleton-method:
         # Customizable data column name.  Defaults to 'data'.
         cattr_accessor :data_column_name
         self.data_column_name = 'data'
@@ -166,17 +168,25 @@ class CGI
       # binary session data in a +text+ column.  For higher performance,
       # store in a +blob+ column instead and forgo the Base64 encoding.
       class SqlBypass
+        ##
+        # :singleton-method:
         # Use the ActiveRecord::Base.connection by default.
         cattr_accessor :connection
 
+        ##
+        # :singleton-method:
         # The table name defaults to 'sessions'.
         cattr_accessor :table_name
         @@table_name = 'sessions'
 
+        ##
+        # :singleton-method:
         # The session id field defaults to 'session_id'.
         cattr_accessor :session_id_column
         @@session_id_column = 'session_id'
 
+        ##
+        # :singleton-method:
         # The data field defaults to 'data'.
         cattr_accessor :data_column
         @@data_column = 'data'</diff>
      <filename>actionpack/lib/action_controller/session/active_record_store.rb</filename>
    </modified>
    <modified>
      <diff>@@ -183,13 +183,17 @@ module ActionView #:nodoc:
       @@exempt_from_layout.merge(regexps)
     end
 
+    @@debug_rjs = false
+    ##
+    # :singleton-method:
     # Specify whether RJS responses should be wrapped in a try/catch block
     # that alert()s the caught exception (and then re-raises it).
-    @@debug_rjs = false
     cattr_accessor :debug_rjs
 
-    # A warning will be displayed whenever an action results in a cache miss on your view paths.
     @@warn_cache_misses = false
+    ##
+    # :singleton-method:
+    # A warning will be displayed whenever an action results in a cache miss on your view paths.
     cattr_accessor :warn_cache_misses
 
     attr_internal :request</diff>
      <filename>actionpack/lib/action_view/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -97,7 +97,7 @@ module ActionView
       # Returns an escaped version of +html+ without affecting existing escaped entities.
       #
       # ==== Examples
-      #   escape_once(&quot;1 &gt; 2 &amp;amp; 3&quot;)
+      #   escape_once(&quot;1 &lt; 2 &amp;amp; 3&quot;)
       #   # =&gt; &quot;1 &amp;lt; 2 &amp;amp; 3&quot;
       #
       #   escape_once(&quot;&amp;lt;&amp;lt; Accept &amp; Checkout&quot;)</diff>
      <filename>actionpack/lib/action_view/helpers/tag_helper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -3,6 +3,8 @@ module ActionView
     class ERB &lt; TemplateHandler
       include Compilable
 
+      ##
+      # :singleton-method:
       # Specify trim mode for the ERB compiler. Defaults to '-'.
       # See ERb documentation for suitable values.
       cattr_accessor :erb_trim_mode</diff>
      <filename>actionpack/lib/action_view/template_handlers/erb.rb</filename>
    </modified>
    <modified>
      <diff>@@ -24,6 +24,8 @@ module ActiveModel
       :even                     =&gt; &quot;must be even&quot;
     }
   
+    ##
+    # :singleton-method:
     # Holds a hash with all the default error messages that can be replaced by your own copy or localizations.
     cattr_accessor :default_error_messages
 </diff>
      <filename>activemodel/lib/active_model/errors.rb</filename>
    </modified>
    <modified>
      <diff>@@ -389,6 +389,8 @@ module ActiveRecord #:nodoc:
   # So it's possible to assign a logger to the class through &lt;tt&gt;Base.logger=&lt;/tt&gt; which will then be used by all
   # instances in the current object space.
   class Base
+    ##  
+    # :singleton-method:
     # Accepts a logger conforming to the interface of Log4r or the default Ruby 1.8+ Logger class, which is then passed
     # on to any new database connections made and which can be retrieved on both a class and instance level by calling +logger+.
     cattr_accessor :logger, :instance_writer =&gt; false
@@ -414,7 +416,9 @@ module ActiveRecord #:nodoc:
     end
 
     @@subclasses = {}
-
+    
+    ##
+    # :singleton-method:
     # Contains the database configuration - as is typically stored in config/database.yml -
     # as a Hash.
     #
@@ -443,6 +447,8 @@ module ActiveRecord #:nodoc:
     cattr_accessor :configurations, :instance_writer =&gt; false
     @@configurations = {}
 
+    ##
+    # :singleton-method:
     # Accessor for the prefix type that will be prepended to every primary key column name. The options are :table_name and
     # :table_name_with_underscore. If the first is specified, the Product class will look for &quot;productid&quot; instead of &quot;id&quot; as
     # the primary column. If the latter is specified, the Product class will look for &quot;product_id&quot; instead of &quot;id&quot;. Remember
@@ -450,34 +456,46 @@ module ActiveRecord #:nodoc:
     cattr_accessor :primary_key_prefix_type, :instance_writer =&gt; false
     @@primary_key_prefix_type = nil
 
+    ##
+    # :singleton-method:
     # Accessor for the name of the prefix string to prepend to every table name. So if set to &quot;basecamp_&quot;, all
     # table names will be named like &quot;basecamp_projects&quot;, &quot;basecamp_people&quot;, etc. This is a convenient way of creating a namespace
     # for tables in a shared database. By default, the prefix is the empty string.
     cattr_accessor :table_name_prefix, :instance_writer =&gt; false
     @@table_name_prefix = &quot;&quot;
 
+    ##
+    # :singleton-method:
     # Works like +table_name_prefix+, but appends instead of prepends (set to &quot;_basecamp&quot; gives &quot;projects_basecamp&quot;,
     # &quot;people_basecamp&quot;). By default, the suffix is the empty string.
     cattr_accessor :table_name_suffix, :instance_writer =&gt; false
     @@table_name_suffix = &quot;&quot;
 
+    ##
+    # :singleton-method:
     # Indicates whether table names should be the pluralized versions of the corresponding class names.
     # If true, the default table name for a Product class will be +products+. If false, it would just be +product+.
     # See table_name for the full rules on table/class naming. This is true, by default.
     cattr_accessor :pluralize_table_names, :instance_writer =&gt; false
     @@pluralize_table_names = true
 
+    ##
+    # :singleton-method:
     # Determines whether to use ANSI codes to colorize the logging statements committed by the connection adapter. These colors
     # make it much easier to overview things during debugging (when used through a reader like +tail+ and on a black background), but
     # may complicate matters if you use software like syslog. This is true, by default.
     cattr_accessor :colorize_logging, :instance_writer =&gt; false
     @@colorize_logging = true
 
+    ##
+    # :singleton-method:
     # Determines whether to use Time.local (using :local) or Time.utc (using :utc) when pulling dates and times from the database.
     # This is set to :local by default.
     cattr_accessor :default_timezone, :instance_writer =&gt; false
     @@default_timezone = :local
 
+    ##
+    # :singleton-method:
     # Specifies the format to use when dumping the database schema with Rails'
     # Rakefile.  If :sql, the schema is dumped as (potentially database-
     # specific) SQL statements.  If :ruby, the schema is dumped as an
@@ -487,6 +505,8 @@ module ActiveRecord #:nodoc:
     cattr_accessor :schema_format , :instance_writer =&gt; false
     @@schema_format = :ruby
 
+    ##
+    # :singleton-method:
     # Specify whether or not to use timestamps for migration numbers
     cattr_accessor :timestamped_migrations , :instance_writer =&gt; false
     @@timestamped_migrations = true
@@ -640,16 +660,24 @@ module ActiveRecord #:nodoc:
         connection.select_all(sanitize_sql(sql), &quot;#{name} Load&quot;).collect! { |record| instantiate(record) }
       end
 
-      # Checks whether a record exists in the database that matches conditions given.  These conditions
-      # can either be a single integer representing a primary key id to be found, or a condition to be
-      # matched like using ActiveRecord#find.
+
+      # Returns true if a record exists in the table that matches the +id+ or
+      # conditions given, or false otherwise. The argument can take four forms:
+      #
+      # * Integer - Finds the record with this primary key.
+      # * String - Finds the record with a primary key corresponding to this
+      #   string (such as &lt;tt&gt;'5'&lt;/tt&gt;).
+      # * Array - Finds the record that matches these +find+-style conditions
+      #   (such as &lt;tt&gt;['color = ?', 'red']&lt;/tt&gt;).
+      # * Hash - Finds the record that matches these +find+-style conditions
+      #   (such as &lt;tt&gt;{:color =&gt; 'red'}&lt;/tt&gt;).
       #
-      # The +id_or_conditions+ parameter can be an Integer or a String if you want to search the primary key
-      # column of the table for a matching id, or if you're looking to match against a condition you can use
-      # an Array or a Hash.
+      # For more information about specifying conditions as a Hash or Array,
+      # see the Conditions section in the introduction to ActiveRecord::Base.
       #
-      # Possible gotcha: You can't pass in a condition as a string e.g. &quot;name = 'Jamie'&quot;, this would be
-      # sanitized and then queried against the primary key column as &quot;id = 'name = \'Jamie&quot;
+      # Note: You can't pass in a condition as a string (like &lt;tt&gt;name =
+      # 'Jamie'&lt;/tt&gt;), since it would be sanitized and then queried against
+      # the primary key column, like &lt;tt&gt;id = 'name = \'Jamie\''&lt;/tt&gt;.
       #
       # ==== Examples
       #   Person.exists?(5)
@@ -2320,15 +2348,15 @@ module ActiveRecord #:nodoc:
       # object. The default implementation returns this record's id as a String,
       # or nil if this record's unsaved.
       #
-      # For example, suppose that you have a Users model, and that you have a
-      # &lt;tt&gt;map.resources :users&lt;/tt&gt; route. Normally, +users_path+ will
-      # construct an URI with the user object's 'id' in it:
+      # For example, suppose that you have a User model, and that you have a
+      # &lt;tt&gt;map.resources :users&lt;/tt&gt; route. Normally, +user_path+ will
+      # construct a path with the user object's 'id' in it:
       #
       #   user = User.find_by_name('Phusion')
       #   user_path(user)  # =&gt; &quot;/users/1&quot;
       #
-      # You can override +to_param+ in your model to make +users_path+ construct
-      # an URI using the user's name instead of the user's id:
+      # You can override +to_param+ in your model to make +user_path+ construct
+      # a path using the user's name instead of the user's id:
       #
       #   class User &lt; ActiveRecord::Base
       #     def to_param  # overridden</diff>
      <filename>activerecord/lib/active_record/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -7,6 +7,8 @@ module ActiveRecord
       end
     end
 
+    ##
+    # :singleton-method:
     # The connection handler
     cattr_accessor :connection_handler, :instance_writer =&gt; false
     @@connection_handler = ConnectionAdapters::ConnectionHandler.new</diff>
      <filename>activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb</filename>
    </modified>
    <modified>
      <diff>@@ -156,13 +156,16 @@ module ActiveRecord
     # * &lt;tt&gt;:sslcapath&lt;/tt&gt; - Necessary to use MySQL with an SSL connection.
     # * &lt;tt&gt;:sslcipher&lt;/tt&gt; - Necessary to use MySQL with an SSL connection.
     #
-    # By default, the MysqlAdapter will consider all columns of type &lt;tt&gt;tinyint(1)&lt;/tt&gt;
-    # as boolean. If you wish to disable this emulation (which was the default
-    # behavior in versions 0.13.1 and earlier) you can add the following line
-    # to your environment.rb file:
-    #
-    #   ActiveRecord::ConnectionAdapters::MysqlAdapter.emulate_booleans = false
     class MysqlAdapter &lt; AbstractAdapter
+
+      ##
+      # :singleton-method:
+      # By default, the MysqlAdapter will consider all columns of type &lt;tt&gt;tinyint(1)&lt;/tt&gt;
+      # as boolean. If you wish to disable this emulation (which was the default
+      # behavior in versions 0.13.1 and earlier) you can add the following line
+      # to your environment.rb file:
+      #
+      #   ActiveRecord::ConnectionAdapters::MysqlAdapter.emulate_booleans = false
       cattr_accessor :emulate_booleans
       self.emulate_booleans = true
 </diff>
      <filename>activerecord/lib/active_record/connection_adapters/mysql_adapter.rb</filename>
    </modified>
    <modified>
      <diff>@@ -130,7 +130,9 @@ module ActiveRecord
   # To run migrations against the currently configured database, use
   # &lt;tt&gt;rake db:migrate&lt;/tt&gt;. This will update the database by running all of the
   # pending migrations, creating the &lt;tt&gt;schema_migrations&lt;/tt&gt; table
-  # (see &quot;About the schema_migrations table&quot; section below) if missing.
+  # (see &quot;About the schema_migrations table&quot; section below) if missing. It will also 
+  # invoke the db:schema:dump task, which will update your db/schema.rb file
+  # to match the structure of your database.
   #
   # To roll the database back to a previous migration version, use
   # &lt;tt&gt;rake db:migrate VERSION=X&lt;/tt&gt; where &lt;tt&gt;X&lt;/tt&gt; is the version to which</diff>
      <filename>activerecord/lib/active_record/migration.rb</filename>
    </modified>
    <modified>
      <diff>@@ -7,6 +7,8 @@ module ActiveRecord
   class SchemaDumper #:nodoc:
     private_class_method :new
     
+    ##
+    # :singleton-method:
     # A list of tables which should not be dumped to the schema. 
     # Acceptable values are strings as well as regexp.
     # This setting is only used if ActiveRecord::Base.schema_format == :ruby</diff>
      <filename>activerecord/lib/active_record/schema_dumper.rb</filename>
    </modified>
    <modified>
      <diff>@@ -494,18 +494,20 @@ module ActiveRecord
       # The first_name attribute must be in the object and it cannot be blank.
       #
       # If you want to validate the presence of a boolean field (where the real values are true and false),
-      # you will want to use validates_inclusion_of :field_name, :in =&gt; [true, false]
-      # This is due to the way Object#blank? handles boolean values. false.blank? # =&gt; true
+      # you will want to use &lt;tt&gt;validates_inclusion_of :field_name, :in =&gt; [true, false]&lt;/tt&gt;.
+      #
+      # This is due to the way Object#blank? handles boolean values: &lt;tt&gt;false.blank? # =&gt; true&lt;/tt&gt;.
       #
       # Configuration options:
       # * &lt;tt&gt;message&lt;/tt&gt; - A custom error message (default is: &quot;can't be blank&quot;).
-      # * &lt;tt&gt;on&lt;/tt&gt; - Specifies when this validation is active (default is &lt;tt&gt;:save&lt;/tt&gt;, other options &lt;tt&gt;:create&lt;/tt&gt;, &lt;tt&gt;:update&lt;/tt&gt;).
+      # * &lt;tt&gt;on&lt;/tt&gt; - Specifies when this validation is active (default is &lt;tt&gt;:save&lt;/tt&gt;, other options &lt;tt&gt;:create&lt;/tt&gt;, 
+      #   &lt;tt&gt;:update&lt;/tt&gt;).
       # * &lt;tt&gt;if&lt;/tt&gt; - Specifies a method, proc or string to call to determine if the validation should
-      #   occur (e.g. :if =&gt; :allow_validation, or :if =&gt; Proc.new { |user| user.signup_step &gt; 2 }).  The
-      #   method, proc or string should return or evaluate to a true or false value.
+      #   occur (e.g. &lt;tt&gt;:if =&gt; :allow_validation&lt;/tt&gt;, or &lt;tt&gt;:if =&gt; Proc.new { |user| user.signup_step &gt; 2 }&lt;/tt&gt;).
+      #   The method, proc or string should return or evaluate to a true or false value.
       # * &lt;tt&gt;unless&lt;/tt&gt; - Specifies a method, proc or string to call to determine if the validation should
-      #   not occur (e.g. :unless =&gt; :skip_validation, or :unless =&gt; Proc.new { |user| user.signup_step &lt;= 2 }).  The
-      #   method, proc or string should return or evaluate to a true or false value.
+      #   not occur (e.g. &lt;tt&gt;:unless =&gt; :skip_validation&lt;/tt&gt;, or &lt;tt&gt;:unless =&gt; Proc.new { |user| user.signup_step &lt;= 2 }&lt;/tt&gt;).
+      #   The method, proc or string should return or evaluate to a true or false value.
       #
       def validates_presence_of(*attr_names)
         configuration = { :on =&gt; :save }</diff>
      <filename>activerecord/lib/active_record/validations.rb</filename>
    </modified>
    <modified>
      <diff>@@ -202,6 +202,8 @@ module ActiveResource
   # sets the &lt;tt&gt;read_timeout&lt;/tt&gt; of the internal Net::HTTP instance to the same value. The default
   # &lt;tt&gt;read_timeout&lt;/tt&gt; is 60 seconds on most Ruby implementations.
   class Base
+    ##
+    # :singleton-method:
     # The logger for diagnosing and tracing Active Resource calls.
     cattr_accessor :logger
 </diff>
      <filename>activeresource/lib/active_resource/base.rb</filename>
    </modified>
    <modified>
      <diff>@@ -13,6 +13,8 @@ module ActiveSupport
 
     MAX_BUFFER_SIZE = 1000
 
+    ##
+    # :singleton-method:
     # Set to false to disable the silencer
     cattr_accessor :silencer
     self.silencer = true</diff>
      <filename>activesupport/lib/active_support/buffered_logger.rb</filename>
    </modified>
    <modified>
      <diff>@@ -30,6 +30,8 @@ require 'logger'
 #
 # Note: This logger is deprecated in favor of ActiveSupport::BufferedLogger
 class Logger
+  ##
+  # :singleton-method:
   # Set to false to disable the silencer
   cattr_accessor :silencer
   self.silencer = true</diff>
      <filename>activesupport/lib/active_support/core_ext/logger.rb</filename>
    </modified>
    <modified>
      <diff>@@ -254,7 +254,7 @@ module ActiveSupport
     #   @person = Person.find(1)
     #   # =&gt; #&lt;Person id: 1, name: &quot;Donald E. Knuth&quot;&gt;
     #
-    #   &lt;%= link_to(@person.name, person_path %&gt;
+    #   &lt;%= link_to(@person.name, person_path(@person)) %&gt;
     #   # =&gt; &lt;a href=&quot;/person/1-donald-e-knuth&quot;&gt;Donald E. Knuth&lt;/a&gt;
     def parameterize(string, sep = '-')
       re_sep = Regexp.escape(sep)</diff>
      <filename>activesupport/lib/active_support/inflector.rb</filename>
    </modified>
    <modified>
      <diff>@@ -282,6 +282,7 @@ task :guides do
   FileUtils.mkdir(html)
 
   template = File.expand_path(&quot;doc/guides/source/templates/guides.html.erb&quot;)
+  asciidoc_conf = 'doc/guides/asciidoc.conf'
 
   ignore = ['..', 'icons', 'images', 'templates', 'stylesheets']
   ignore &lt;&lt; 'active_record_basics.txt'
@@ -311,7 +312,7 @@ task :guides do
     begin
       puts &quot;GENERATING =&gt; #{output}&quot;
       ENV['MANUALSONRAILS_TOC'] = 'no' if indexless.include?(entry)
-      Mizuho::Generator.new(input, :output =&gt; output, :template =&gt; template).start
+      Mizuho::Generator.new(input, :output =&gt; output, :template =&gt; template, :conf_file =&gt; asciidoc_conf).start
     rescue Mizuho::GenerationError
       STDERR.puts &quot;*** ERROR&quot;
       exit 2</diff>
      <filename>railties/Rakefile</filename>
    </modified>
    <modified>
      <diff>@@ -789,7 +789,7 @@ You can now easily &lt;a href=&quot;http://m.onkey.org/2008/7/20/rescue-from-dispatching
 &lt;/li&gt;
 &lt;li&gt;
 &lt;p&gt;
-The HTTP Accept header is disabled by default now. You should prefer the use of formatted URLs (such as &lt;tt&gt;/customers/1.xml&lt;/tt&gt;) to indicate the format that you want. If you need the Accept headers, you can turn them back on with &lt;tt&gt;config.action_controller.user_accept_header = true&lt;/tt&gt;.
+The HTTP Accept header is disabled by default now. You should prefer the use of formatted URLs (such as &lt;tt&gt;/customers/1.xml&lt;/tt&gt;) to indicate the format that you want. If you need the Accept headers, you can turn them back on with &lt;tt&gt;config.action_controller.use_accept_header = true&lt;/tt&gt;.
 &lt;/p&gt;
 &lt;/li&gt;
 &lt;li&gt;
@@ -974,7 +974,7 @@ The addition of &lt;tt&gt;ActiveSupport::Rescuable&lt;/tt&gt; allows any class to mix in the
 &lt;/li&gt;
 &lt;li&gt;
 &lt;p&gt;
-&lt;tt&gt;Array#second&lt;/tt&gt; through &lt;tt&gt;Array#tenth&lt;/tt&gt; as aliases for &lt;tt&gt;Array#[1]&lt;/tt&gt; through &lt;tt&gt;Array#[9]&lt;/tt&gt;
+&lt;tt&gt;Array#second&lt;/tt&gt; through &lt;tt&gt;Array#fifth&lt;/tt&gt; as aliases for &lt;tt&gt;Array#[1]&lt;/tt&gt; through &lt;tt&gt;Array#[4]&lt;/tt&gt;
 &lt;/p&gt;
 &lt;/li&gt;
 &lt;li&gt;
@@ -994,7 +994,7 @@ The addition of &lt;tt&gt;ActiveSupport::Rescuable&lt;/tt&gt; allows any class to mix in the
 &lt;/li&gt;
 &lt;li&gt;
 &lt;p&gt;
-The included TzInfo library has been upgraded to version 0.3.11.
+The included TzInfo library has been upgraded to version 0.3.12.
 &lt;/p&gt;
 &lt;/li&gt;
 &lt;li&gt;
@@ -1017,7 +1017,7 @@ The included TzInfo library has been upgraded to version 0.3.11.
 &lt;/li&gt;
 &lt;li&gt;
 &lt;p&gt;
-&lt;tt&gt;rake gems&lt;/tt&gt; to list all configured gems, as well as whether they (and their dependencies) are installed or frozen
+&lt;tt&gt;rake gems&lt;/tt&gt; to list all configured gems, as well as whether they (and their dependencies) are installed, frozen, or framework (framework gems are those loaded by Rails before the gem dependency code is executed; such gems cannot be frozen)
 &lt;/p&gt;
 &lt;/li&gt;
 &lt;li&gt;
@@ -1068,6 +1068,11 @@ More information:
 &lt;a href=&quot;http://afreshcup.com/2008/10/25/rails-212-and-22rc1-update-your-rubygems/&quot;&gt;Rails 2.1.2 and 2.2RC1: Update Your RubyGems&lt;/a&gt;
 &lt;/p&gt;
 &lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;a href=&quot;http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1128&quot;&gt;Detailed discussion on Lighthouse&lt;/a&gt;
+&lt;/p&gt;
+&lt;/li&gt;
 &lt;/ul&gt;&lt;/div&gt;
 &lt;/li&gt;
 &lt;/ul&gt;&lt;/div&gt;</diff>
      <filename>railties/doc/guides/html/2_2_release_notes.html</filename>
    </modified>
    <modified>
      <diff>@@ -723,7 +723,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 
 &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Note that while for session values, you set the key to &lt;tt&gt;nil&lt;/tt&gt;, to delete a cookie value, you should use &lt;tt&gt;cookies.delete(:key)&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Note that while for session values you set the key to &lt;tt&gt;nil&lt;/tt&gt;, to delete a cookie value you should use &lt;tt&gt;cookies.delete(:key)&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;
 &lt;/div&gt;
 &lt;h2 id=&quot;_filters&quot;&gt;6. Filters&lt;/h2&gt;
 &lt;div class=&quot;sectionbody&quot;&gt;
@@ -767,7 +767,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 
 &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;In this example, the filter is added to ApplicationController and thus all controllers in the application. This will make everything in the application require the user to be logged in in order to use it. For obvious reasons (the user wouldn't be able to log in in the first place!), not all controllers or actions should require this. You can prevent this filter from running before particular actions with &lt;tt&gt;skip_before_filter&lt;/tt&gt; :&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;In this example, the filter is added to ApplicationController and thus all controllers in the application. This will make everything in the application require the user to be logged in in order to use it. For obvious reasons (the user wouldn't be able to log in in the first place!), not all controllers or actions should require this. You can prevent this filter from running before particular actions with &lt;tt&gt;skip_before_filter&lt;/tt&gt;:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
 by Lorenzo Bettini
@@ -779,7 +779,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 
 &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Now, the &lt;tt&gt;LoginsController&lt;/tt&gt;'s &quot;new&quot; and &quot;create&quot; actions will work as before without requiring the user to be logged in. The &lt;tt&gt;:only&lt;/tt&gt; option is used to only skip this filter for these actions, and there is also an &lt;tt&gt;:except&lt;/tt&gt; option which works the other way. These options can be used when adding filters too, so you can add a filter which only runs for selected actions in the first place.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Now, the LoginsController's &lt;tt&gt;new&lt;/tt&gt; and &lt;tt&gt;create&lt;/tt&gt; actions will work as before without requiring the user to be logged in. The &lt;tt&gt;:only&lt;/tt&gt; option is used to only skip this filter for these actions, and there is also an &lt;tt&gt;:except&lt;/tt&gt; option which works the other way. These options can be used when adding filters too, so you can add a filter which only runs for selected actions in the first place.&lt;/p&gt;&lt;/div&gt;
 &lt;h3 id=&quot;_after_filters_and_around_filters&quot;&gt;6.1. After Filters and Around Filters&lt;/h3&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;In addition to the before filters, you can run filters after an action has run or both before and after. The after filter is similar to the before filter, but because the action has already been run it has access to the response data that's about to be sent to the client. Obviously, after filters can not stop the action from running. Around filters are responsible for running the action, but they can choose not to, which is the around filter's way of stopping it.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
@@ -872,7 +872,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 
 &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Now the &lt;tt&gt;create&lt;/tt&gt; action won't run unless the &quot;username&quot; and &quot;password&quot; parameters are present, and if they're not, an error message will be added to the flash and the &quot;new&quot; action will be rendered. But there's something rather important missing from the verification above: It will be used for &lt;strong&gt;every&lt;/strong&gt; action in LoginsController, which is not what we want. You can limit which actions it will be used for with the &lt;tt&gt;:only&lt;/tt&gt; and &lt;tt&gt;:except&lt;/tt&gt; options just like a filter:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Now the &lt;tt&gt;create&lt;/tt&gt; action won't run unless the &quot;username&quot; and &quot;password&quot; parameters are present, and if they're not, an error message will be added to the flash and the &lt;tt&gt;new&lt;/tt&gt; action will be rendered. But there's something rather important missing from the verification above: It will be used for &lt;strong&gt;every&lt;/strong&gt; action in LoginsController, which is not what we want. You can limit which actions it will be used for with the &lt;tt&gt;:only&lt;/tt&gt; and &lt;tt&gt;:except&lt;/tt&gt; options just like a filter:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
 by Lorenzo Bettini
@@ -934,7 +934,7 @@ host - The hostname used for this request.
 &lt;/li&gt;
 &lt;li&gt;
 &lt;p&gt;
-domain - The hostname without the first segment (usually &quot;www&quot;).
+domain(n=2) - The hostname's first &lt;tt&gt;n&lt;/tt&gt; segments, starting from the right (the TLD)
 &lt;/p&gt;
 &lt;/li&gt;
 &lt;li&gt;
@@ -949,7 +949,7 @@ method - The HTTP method used for the request.
 &lt;/li&gt;
 &lt;li&gt;
 &lt;p&gt;
-get?, post?, put?, delete?, head? - Returns true if the HTTP method is get/post/put/delete/head.
+get?, post?, put?, delete?, head? - Returns true if the HTTP method is GET/POST/PUT/DELETE/HEAD.
 &lt;/p&gt;
 &lt;/li&gt;
 &lt;li&gt;
@@ -964,7 +964,7 @@ port - The port number (integer) used for the request.
 &lt;/li&gt;
 &lt;li&gt;
 &lt;p&gt;
-protocol - The protocol used for the request.
+protocol - Returns a string containing the prototol used plus &quot;://&quot;, for example &quot;http://&quot;
 &lt;/p&gt;
 &lt;/li&gt;
 &lt;li&gt;
@@ -1118,7 +1118,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;td class=&quot;icon&quot;&gt;
 &lt;img src=&quot;./images/icons/tip.png&quot; alt=&quot;Tip&quot; /&gt;
 &lt;/td&gt;
-&lt;td class=&quot;content&quot;&gt;It is not recommended that you stream static files through Rails if you can instead keep them in a public folder on your web server. It is much more efficient to let the user download the file directly using Apache or another web server, keeping the request from unnecessarily going through the whole Rails stack.&lt;/td&gt;
+&lt;td class=&quot;content&quot;&gt;It is not recommended that you stream static files through Rails if you can instead keep them in a public folder on your web server. It is much more efficient to let the user download the file directly using Apache or another web server, keeping the request from unnecessarily going through the whole Rails stack. Although if you do need the request to go through Rails for some reason, you can set the &lt;tt&gt;:x_sendfile&lt;/tt&gt; option to true, and Rails will let the web server handle sending the file to the user, freeing up the Rails process to do other things. Note that your web server needs to support the &lt;tt&gt;X-Sendfile&lt;/tt&gt; header for this to work, and you still have to be careful not to use user input in a way that lets someone retrieve arbitrary files.&lt;/td&gt;
 &lt;/tr&gt;&lt;/table&gt;
 &lt;/div&gt;
 &lt;h3 id=&quot;_restful_downloads&quot;&gt;11.2. RESTful Downloads&lt;/h3&gt;
@@ -1166,7 +1166,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;/div&gt;
 &lt;h2 id=&quot;_parameter_filtering&quot;&gt;12. Parameter Filtering&lt;/h2&gt;
 &lt;div class=&quot;sectionbody&quot;&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Rails keeps a log file for each environment (development, test and production) in the &quot;log&quot; folder. These are extremely useful when debugging what's actually going on in your application, but in a live application you may not want every bit of information to be stored in the log file. The &lt;tt&gt;filter_parameter_logging&lt;/tt&gt; method can be used to filter out sensitive information from the log. It works by replacing certain values in the &lt;tt&gt;params&lt;/tt&gt; hash with &quot;[FILTERED]&quot; as they are written to the log. As an example, let's see how to filter all parameters with keys that include &quot;password&quot;:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Rails keeps a log file for each environment (development, test and production) in the &lt;tt&gt;log&lt;/tt&gt; folder. These are extremely useful when debugging what's actually going on in your application, but in a live application you may not want every bit of information to be stored in the log file. The &lt;tt&gt;filter_parameter_logging&lt;/tt&gt; method can be used to filter out sensitive information from the log. It works by replacing certain values in the &lt;tt&gt;params&lt;/tt&gt; hash with &quot;[FILTERED]&quot; as they are written to the log. As an example, let's see how to filter all parameters with keys that include &quot;password&quot;:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
 by Lorenzo Bettini
@@ -1178,7 +1178,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 
 &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The method works recursively through all levels of the params hash and takes an optional second parameter which is used as the replacement string if present. It can also take a block which receives each key in return and replaces those for which the block returns true.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The method works recursively through all levels of the params hash and takes an optional second parameter which is used as the replacement string if present. It can also take a block which receives each key in turn and replaces those for which the block returns true.&lt;/p&gt;&lt;/div&gt;
 &lt;/div&gt;
 &lt;h2 id=&quot;_rescue&quot;&gt;13. Rescue&lt;/h2&gt;
 &lt;div class=&quot;sectionbody&quot;&gt;</diff>
      <filename>railties/doc/guides/html/actioncontroller_basics.html</filename>
    </modified>
    <modified>
      <diff>@@ -267,6 +267,53 @@ ul#navMain {
 					&lt;a href=&quot;#_writing_your_own_validation_methods&quot;&gt;Writing your own validation methods&lt;/a&gt;
 					&lt;/li&gt;
 					&lt;li&gt;
+					&lt;a href=&quot;#_using_the_tt_errors_tt_collection&quot;&gt;Using the &lt;tt&gt;errors&lt;/tt&gt; collection&lt;/a&gt;
+					&lt;/li&gt;
+					&lt;li&gt;
+					&lt;a href=&quot;#_callbacks&quot;&gt;Callbacks&lt;/a&gt;
+						&lt;ul&gt;
+						
+							&lt;li&gt;&lt;a href=&quot;#_callbacks_registration&quot;&gt;Callbacks registration&lt;/a&gt;&lt;/li&gt;
+						
+							&lt;li&gt;&lt;a href=&quot;#_registering_callbacks_by_overriding_the_callback_methods&quot;&gt;Registering callbacks by overriding the callback methods&lt;/a&gt;&lt;/li&gt;
+						
+							&lt;li&gt;&lt;a href=&quot;#_registering_callbacks_by_using_macro_style_class_methods&quot;&gt;Registering callbacks by using macro-style class methods&lt;/a&gt;&lt;/li&gt;
+						
+						&lt;/ul&gt;
+					&lt;/li&gt;
+					&lt;li&gt;
+					&lt;a href=&quot;#_available_callbacks&quot;&gt;Available callbacks&lt;/a&gt;
+						&lt;ul&gt;
+						
+							&lt;li&gt;&lt;a href=&quot;#_callbacks_called_both_when_creating_or_updating_a_record&quot;&gt;Callbacks called both when creating or updating a record.&lt;/a&gt;&lt;/li&gt;
+						
+							&lt;li&gt;&lt;a href=&quot;#_callbacks_called_only_when_creating_a_new_record&quot;&gt;Callbacks called only when creating a new record.&lt;/a&gt;&lt;/li&gt;
+						
+							&lt;li&gt;&lt;a href=&quot;#_callbacks_called_only_when_updating_an_existing_record&quot;&gt;Callbacks called only when updating an existing record.&lt;/a&gt;&lt;/li&gt;
+						
+							&lt;li&gt;&lt;a href=&quot;#_callbacks_called_when_removing_a_record_from_the_database&quot;&gt;Callbacks called when removing a record from the database.&lt;/a&gt;&lt;/li&gt;
+						
+							&lt;li&gt;&lt;a href=&quot;#_the_tt_after_initialize_tt_and_tt_after_find_tt_callbacks&quot;&gt;The &lt;tt&gt;after_initialize&lt;/tt&gt; and &lt;tt&gt;after_find&lt;/tt&gt; callbacks&lt;/a&gt;&lt;/li&gt;
+						
+						&lt;/ul&gt;
+					&lt;/li&gt;
+					&lt;li&gt;
+					&lt;a href=&quot;#_halting_execution&quot;&gt;Halting Execution&lt;/a&gt;
+					&lt;/li&gt;
+					&lt;li&gt;
+					&lt;a href=&quot;#_callback_classes&quot;&gt;Callback classes&lt;/a&gt;
+					&lt;/li&gt;
+					&lt;li&gt;
+					&lt;a href=&quot;#_observers&quot;&gt;Observers&lt;/a&gt;
+						&lt;ul&gt;
+						
+							&lt;li&gt;&lt;a href=&quot;#_registering_observers&quot;&gt;Registering observers&lt;/a&gt;&lt;/li&gt;
+						
+							&lt;li&gt;&lt;a href=&quot;#_where_to_put_the_observers_source_files&quot;&gt;Where to put the observers' source files&lt;/a&gt;&lt;/li&gt;
+						
+						&lt;/ul&gt;
+					&lt;/li&gt;
+					&lt;li&gt;
 					&lt;a href=&quot;#_changelog&quot;&gt;Changelog&lt;/a&gt;
 					&lt;/li&gt;
 			&lt;/ol&gt;
@@ -358,7 +405,15 @@ http://www.gnu.org/software/src-highlite --&gt;
 &amp;gt;&amp;gt; p.new_record?
 =&amp;gt; false&lt;/tt&gt;&lt;/pre&gt;
 &lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Saving new records means sending an SQL insert operation to the database, while saving existing records (by calling either &lt;tt&gt;save&lt;/tt&gt;, &lt;tt&gt;update_attribute&lt;/tt&gt; or &lt;tt&gt;update_attributes&lt;/tt&gt;) will result in a SQL update operation. Active Record will use this facts to perform validations upon your objects, avoiding then to be recorded to the database if their inner state is invalid in some way. You can specify validations that will be beformed every time a object is saved, just when you're creating a new record or when you're updating an existing one.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Saving new records means sending an SQL insert operation to the database, while saving existing records (by calling either &lt;tt&gt;save&lt;/tt&gt; or &lt;tt&gt;update_attributes&lt;/tt&gt;) will result in a SQL update operation. Active Record will use this facts to perform validations upon your objects, avoiding then to be recorded to the database if their inner state is invalid in some way. You can specify validations that will be beformed every time a object is saved, just when you're creating a new record or when you're updating an existing one.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;admonitionblock&quot;&gt;
+&lt;table&gt;&lt;tr&gt;
+&lt;td class=&quot;icon&quot;&gt;
+&lt;img src=&quot;./images/icons/caution.png&quot; alt=&quot;Caution&quot; /&gt;
+&lt;/td&gt;
+&lt;td class=&quot;content&quot;&gt;There are four methods that when called will trigger validation: &lt;tt&gt;save&lt;/tt&gt;, &lt;tt&gt;save!&lt;/tt&gt;, &lt;tt&gt;update_attributes&lt;/tt&gt; and &lt;tt&gt;update_attributes!&lt;/tt&gt;. There is one method left, which is &lt;tt&gt;update_attribute&lt;/tt&gt;. This method will update the value of an attribute without triggering any validation, so be careful when using &lt;tt&gt;update_attribute&lt;/tt&gt;, since it can let you save your objects in an invalid state.&lt;/td&gt;
+&lt;/tr&gt;&lt;/table&gt;
+&lt;/div&gt;
 &lt;h3 id=&quot;_the_meaning_of_em_valid_em&quot;&gt;2.2. The meaning of &lt;em&gt;valid&lt;/em&gt;&lt;/h3&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;For verifying if an object is valid, Active Record uses the &lt;tt&gt;valid?&lt;/tt&gt; method, which basically looks inside the object to see if it has any validation errors. These errors live in a collection that can be accessed through the &lt;tt&gt;errors&lt;/tt&gt; instance method. The proccess is really simple: If the &lt;tt&gt;errors&lt;/tt&gt; method returns an empty collection, the object is valid and can be saved. Each time a validation fails, an error message is added to the &lt;tt&gt;errors&lt;/tt&gt; collection.&lt;/p&gt;&lt;/div&gt;
 &lt;/div&gt;
@@ -719,7 +774,7 @@ http://www.gnu.org/software/src-highlite --&gt;
   &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;If your validation rules are too complicated and you want to break it in small methods, you can implement all of them and call one of &lt;tt&gt;validate&lt;/tt&gt;, &lt;tt&gt;validate_on_create&lt;/tt&gt; or &lt;tt&gt;validate_on_update&lt;/tt&gt; methods, passing it the symbols for the methods' names.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;If your validation rules are too complicated and you want to break them in small methods, you can implement all of them and call one of &lt;tt&gt;validate&lt;/tt&gt;, &lt;tt&gt;validate_on_create&lt;/tt&gt; or &lt;tt&gt;validate_on_update&lt;/tt&gt; methods, passing it the symbols for the methods' names.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
 by Lorenzo Bettini
@@ -738,7 +793,400 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;/div&gt;
-&lt;h2 id=&quot;_changelog&quot;&gt;7. Changelog&lt;/h2&gt;
+&lt;h2 id=&quot;_using_the_tt_errors_tt_collection&quot;&gt;7. Using the &lt;tt&gt;errors&lt;/tt&gt; collection&lt;/h2&gt;
+&lt;div class=&quot;sectionbody&quot;&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;You can do more than just call &lt;tt&gt;valid?&lt;/tt&gt; upon your objects based on the existance of the &lt;tt&gt;errors&lt;/tt&gt; collection. Here is a list of the other available methods that you can use to manipulate errors or ask for an object's state.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;ilist&quot;&gt;&lt;ul&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;tt&gt;add_to_base&lt;/tt&gt; lets you add errors messages that are related to the object's state as a whole, instead of being related to a specific attribute. You can use this method when you want to say that the object is invalid, no matter the values of it's attributes. &lt;tt&gt;add_to_base&lt;/tt&gt; receives a string with the message.
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;/ul&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; Person &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Base
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; a_method_used_for_validation_purposes
+    errors&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;add_to_base&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;This person is invalid because ...&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;ilist&quot;&gt;&lt;ul&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;tt&gt;add&lt;/tt&gt; lets you manually add messages that are related to particular attributes. When writing those messages, keep in mind that Rails will prepend them with the name of the attribute that holds the error, so write it in a way that makes sense. &lt;tt&gt;add&lt;/tt&gt; receives a symbol with the name of the attribute that you want to add the message to and the message itself.
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;/ul&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; Person &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Base
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; a_method_used_for_validation_purposes
+    errors&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;add&lt;span style=&quot;color: #990000&quot;&gt;(:&lt;/span&gt;name&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;can't have the characters !@#$%*()_-+=&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;ilist&quot;&gt;&lt;ul&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;tt&gt;invalid?&lt;/tt&gt; is used when you want to check if a particular attribute is invalid. It receives a symbol with the name of the attribute that you want to check.
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;/ul&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; Person &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Base
+  validates_presence_of &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;name&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;email
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+person &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; Person&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;new&lt;span style=&quot;color: #990000&quot;&gt;(:&lt;/span&gt;name &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;John Doe&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+person&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;invalid?&lt;span style=&quot;color: #990000&quot;&gt;(:&lt;/span&gt;email&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# =&amp;gt; true&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;ilist&quot;&gt;&lt;ul&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;tt&gt;on&lt;/tt&gt; is used when you want to check the error messages for a specific attribute. It will return different kinds of objects depending on the state of the &lt;tt&gt;errors&lt;/tt&gt; collection for the given attribute. If there are no errors related to the attribute, &lt;tt&gt;on&lt;/tt&gt; will return &lt;tt&gt;nil&lt;/tt&gt;. If there is just one errors message for this attribute, &lt;tt&gt;on&lt;/tt&gt; will return a string with the message. When &lt;tt&gt;errors&lt;/tt&gt; holds two or more error messages for the attribute, &lt;tt&gt;on&lt;/tt&gt; will return an array of strings, each one with one error message.
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;/ul&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; Person &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Base
+  validates_presence_of &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;name
+  validates_length_of &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;name&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;minimum &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #993399&quot;&gt;3&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+person &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; Person&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;new&lt;span style=&quot;color: #990000&quot;&gt;(:&lt;/span&gt;name &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;John Doe&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+person&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;valid? &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# =&amp;gt; true&lt;/span&gt;&lt;/span&gt;
+person&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;errors&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;on&lt;span style=&quot;color: #990000&quot;&gt;(:&lt;/span&gt;name&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# =&amp;gt; nil&lt;/span&gt;&lt;/span&gt;
+
+person &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; Person&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;new&lt;span style=&quot;color: #990000&quot;&gt;(:&lt;/span&gt;name &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;JD&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+person&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;valid? &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# =&amp;gt; false&lt;/span&gt;&lt;/span&gt;
+person&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;errors&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;on&lt;span style=&quot;color: #990000&quot;&gt;(:&lt;/span&gt;name&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# =&amp;gt; &quot;is too short (minimum is 3 characters)&quot;&lt;/span&gt;&lt;/span&gt;
+
+person &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; Person&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;new
+person&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;valid? &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# =&amp;gt; false&lt;/span&gt;&lt;/span&gt;
+person&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;errors&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;on&lt;span style=&quot;color: #990000&quot;&gt;(:&lt;/span&gt;name&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# =&amp;gt; [&quot;can't be blank&quot;, &quot;is too short (minimum is 3 characters)&quot;]&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;ilist&quot;&gt;&lt;ul&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;tt&gt;clear&lt;/tt&gt; is used when you intentionally wants to clear all the messages in the &lt;tt&gt;errors&lt;/tt&gt; collection.
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;/ul&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; Person &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Base
+  validates_presence_of &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;name
+  validates_length_of &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;name&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;minimum &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #993399&quot;&gt;3&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+person &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; Person&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;new
+puts person&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;valid? &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# =&amp;gt; false&lt;/span&gt;&lt;/span&gt;
+person&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;errors&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;on&lt;span style=&quot;color: #990000&quot;&gt;(:&lt;/span&gt;name&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# =&amp;gt; [&quot;can't be blank&quot;, &quot;is too short (minimum is 3 characters)&quot;]&lt;/span&gt;&lt;/span&gt;
+person&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;errors&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;clear
+person&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;errors &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# =&amp;gt; nil&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;/div&gt;
+&lt;h2 id=&quot;_callbacks&quot;&gt;8. Callbacks&lt;/h2&gt;
+&lt;div class=&quot;sectionbody&quot;&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Callbacks are methods that get called at certain moments of an object's lifecycle. With callbacks it's possible to write code that will run whenever an Active Record object is created, saved, updated, deleted or loaded from the database.&lt;/p&gt;&lt;/div&gt;
+&lt;h3 id=&quot;_callbacks_registration&quot;&gt;8.1. Callbacks registration&lt;/h3&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;In order to use the available callbacks, you need to registrate them. There are two ways of doing that.&lt;/p&gt;&lt;/div&gt;
+&lt;h3 id=&quot;_registering_callbacks_by_overriding_the_callback_methods&quot;&gt;8.2. Registering callbacks by overriding the callback methods&lt;/h3&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;You can specify the callback method direcly, by overriding it. Let's see how it works using the &lt;tt&gt;before_validation&lt;/tt&gt; callback, which will surprisingly run right before any validation is done.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; User &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Base
+  validates_presence_of &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;login&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;email
+
+  protected
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; before_validation
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;if&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;self&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;login&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;nil&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;?&lt;/span&gt;
+      &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;self&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;login &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; email &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;unless&lt;/span&gt;&lt;/span&gt; email&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;blank?
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;h3 id=&quot;_registering_callbacks_by_using_macro_style_class_methods&quot;&gt;8.3. Registering callbacks by using macro-style class methods&lt;/h3&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The other way you can register a callback method is by implementing it as an ordinary method, and then using a macro-style class method to register it as a callback. The last example could be written like that:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; User &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Base
+  validates_presence_of &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;login&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;email
+
+  before_validation &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;ensure_login_has_a_value
+
+  protected
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; ensure_login_has_a_value
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;if&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;self&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;login&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;nil&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;?&lt;/span&gt;
+      &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;self&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;login &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; email &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;unless&lt;/span&gt;&lt;/span&gt; email&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;blank?
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The macro-style class methods can also receive a block. Rails best practices say that you should only use this style of registration if the code inside your block is so short that it fits in just one line.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; User &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Base
+  validates_presence_of &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;login&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;email
+
+  before_create &lt;span style=&quot;color: #FF0000&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;user&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt; user&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;name &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; user&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;login&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;capitalize &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;if&lt;/span&gt;&lt;/span&gt; user&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;name&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;blank?&lt;span style=&quot;color: #FF0000&quot;&gt;}&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;In Rails, the preferred way of registering callbacks is by using macro-style class methods. The main advantages of using macro-style class methods are:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;ilist&quot;&gt;&lt;ul&gt;
+&lt;li&gt;
+&lt;p&gt;
+You can add more than one method for each type of callback. Those methods will be queued for execution at the same order they were registered.
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+Readability, since your callback declarations will live at the beggining of your models' files.
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;/ul&gt;&lt;/div&gt;
+&lt;div class=&quot;admonitionblock&quot;&gt;
+&lt;table&gt;&lt;tr&gt;
+&lt;td class=&quot;icon&quot;&gt;
+&lt;img src=&quot;./images/icons/caution.png&quot; alt=&quot;Caution&quot; /&gt;
+&lt;/td&gt;
+&lt;td class=&quot;content&quot;&gt;Remember to always declare the callback methods as being protected or private. These methods should never be public, otherwise it will be possible to call them from code outside the model, violating object encapsulation and exposing implementation details.&lt;/td&gt;
+&lt;/tr&gt;&lt;/table&gt;
+&lt;/div&gt;
+&lt;/div&gt;
+&lt;h2 id=&quot;_available_callbacks&quot;&gt;9. Available callbacks&lt;/h2&gt;
+&lt;div class=&quot;sectionbody&quot;&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Here is a list with all the available Active Record callbacks, listed in the same order in which they will get called during the respective operations.&lt;/p&gt;&lt;/div&gt;
+&lt;h3 id=&quot;_callbacks_called_both_when_creating_or_updating_a_record&quot;&gt;9.1. Callbacks called both when creating or updating a record.&lt;/h3&gt;
+&lt;div class=&quot;ilist&quot;&gt;&lt;ul&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;tt&gt;before_validation&lt;/tt&gt;
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;tt&gt;after_validation&lt;/tt&gt;
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;tt&gt;before_save&lt;/tt&gt;
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;strong&gt;INSERT OR UPDATE OPERATION&lt;/strong&gt;
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;tt&gt;after_save&lt;/tt&gt;
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;/ul&gt;&lt;/div&gt;
+&lt;h3 id=&quot;_callbacks_called_only_when_creating_a_new_record&quot;&gt;9.2. Callbacks called only when creating a new record.&lt;/h3&gt;
+&lt;div class=&quot;ilist&quot;&gt;&lt;ul&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;tt&gt;before_validation_on_create&lt;/tt&gt;
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;tt&gt;after_validation_on_create&lt;/tt&gt;
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;tt&gt;before_create&lt;/tt&gt;
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;strong&gt;INSERT OPERATION&lt;/strong&gt;
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;tt&gt;after_create&lt;/tt&gt;
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;/ul&gt;&lt;/div&gt;
+&lt;h3 id=&quot;_callbacks_called_only_when_updating_an_existing_record&quot;&gt;9.3. Callbacks called only when updating an existing record.&lt;/h3&gt;
+&lt;div class=&quot;ilist&quot;&gt;&lt;ul&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;tt&gt;before_validation_on_update&lt;/tt&gt;
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;tt&gt;after_validation_on_update&lt;/tt&gt;
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;tt&gt;before_update&lt;/tt&gt;
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;strong&gt;UPDATE OPERATION&lt;/strong&gt;
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;tt&gt;after_update&lt;/tt&gt;
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;/ul&gt;&lt;/div&gt;
+&lt;h3 id=&quot;_callbacks_called_when_removing_a_record_from_the_database&quot;&gt;9.4. Callbacks called when removing a record from the database.&lt;/h3&gt;
+&lt;div class=&quot;ilist&quot;&gt;&lt;ul&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;tt&gt;before_destroy&lt;/tt&gt;
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;strong&gt;DELETE OPERATION&lt;/strong&gt;
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;tt&gt;after_destroy&lt;/tt&gt;
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;/ul&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The &lt;tt&gt;before_destroy&lt;/tt&gt; and &lt;tt&gt;after_destroy&lt;/tt&gt; callbacks will only be called if you delete the model using either the &lt;tt&gt;destroy&lt;/tt&gt; instance method or one of the &lt;tt&gt;destroy&lt;/tt&gt; or &lt;tt&gt;destroy_all&lt;/tt&gt; class methods of your Active Record class. If you use &lt;tt&gt;delete&lt;/tt&gt; or &lt;tt&gt;delete_all&lt;/tt&gt; no callback operations will run, since Active Record will not instantiate any objects, accessing the records to be deleted directly in the database.&lt;/p&gt;&lt;/div&gt;
+&lt;h3 id=&quot;_the_tt_after_initialize_tt_and_tt_after_find_tt_callbacks&quot;&gt;9.5. The &lt;tt&gt;after_initialize&lt;/tt&gt; and &lt;tt&gt;after_find&lt;/tt&gt; callbacks&lt;/h3&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The &lt;tt&gt;after_initialize&lt;/tt&gt; callback will be called whenever an Active Record object is instantiated, either by direcly using &lt;tt&gt;new&lt;/tt&gt; or when a record is loaded from the database. It can be useful to avoid the need to directly override your Active Record &lt;tt&gt;initialize&lt;/tt&gt; method.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The &lt;tt&gt;after_find&lt;/tt&gt; callback will be called whenever Active Record loads a record from the database. When used together with &lt;tt&gt;after_initialize&lt;/tt&gt; it will run first, since Active Record will first read the record from the database and them create the model object that will hold it.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The &lt;tt&gt;after_initialize&lt;/tt&gt; and &lt;tt&gt;after_find&lt;/tt&gt; callbacks are a bit different from the others, since the only way to register those callbacks is by defining them as methods. If you try to register &lt;tt&gt;after_initialize&lt;/tt&gt; or &lt;tt&gt;after_find&lt;/tt&gt; using macro-style class methods, they will just be ignored. This behaviour is due to performance reasons, since &lt;tt&gt;after_initialize&lt;/tt&gt; and &lt;tt&gt;after_find&lt;/tt&gt; will both be called for each record found in the database, significantly slowing down the queries.&lt;/p&gt;&lt;/div&gt;
+&lt;/div&gt;
+&lt;h2 id=&quot;_halting_execution&quot;&gt;10. Halting Execution&lt;/h2&gt;
+&lt;div class=&quot;sectionbody&quot;&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;As you start registering new callbacks for your models, they will be queued for execution. This queue will include all your model's validations, the registered callbacks and the database operation to be executed. However, if at any moment one of the callback methods returns a boolean &lt;tt&gt;false&lt;/tt&gt; (not &lt;tt&gt;nil&lt;/tt&gt;) value, this execution chain will be halted and the desired operation will not complete: your model will not get persisted in the database, or your records will not get deleted and so on.&lt;/p&gt;&lt;/div&gt;
+&lt;/div&gt;
+&lt;h2 id=&quot;_callback_classes&quot;&gt;11. Callback classes&lt;/h2&gt;
+&lt;div class=&quot;sectionbody&quot;&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Sometimes the callback methods that you'll write will be useful enough to be reused at other models. Active Record makes it possible to create classes that encapsulate the callback methods, so it becomes very easy to reuse them.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Here's an example where we create a class with a after_destroy callback for a PictureFile model.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; PictureFileCallbacks
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; after_destroy&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;picture_file&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+    File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;delete&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;picture_file&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;filepath&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;if&lt;/span&gt;&lt;/span&gt; File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;exists?&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;picture_file&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;filepath&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;When declared inside a class the callback method will receive the model object as a parameter. We can now use it this way:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; PictureFile &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Base
+  after_destroy PictureFileCallbacks&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;new
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Note that we needed to instantiate a new PictureFileCallbacks object, since we declared our callback as an instance method. Sometimes it will make more sense to have it as a class method.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; PictureFileCallbacks
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;self&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;after_destroy&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;picture_file&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+    File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;delete&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;picture_file&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;filepath&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;if&lt;/span&gt;&lt;/span&gt; File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;exists?&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;picture_file&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;filepath&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;If the callback method is declared this way, it won't be necessary to instantiate a PictureFileCallbacks object.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; PictureFile &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Base
+  after_destroy PictureFileCallbacks
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;You can declare as many callbacks as you want inside your callback classes.&lt;/p&gt;&lt;/div&gt;
+&lt;/div&gt;
+&lt;h2 id=&quot;_observers&quot;&gt;12. Observers&lt;/h2&gt;
+&lt;div class=&quot;sectionbody&quot;&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Active Record callbacks are a powerful feature, but they can pollute your model implementation with code that's not directly related to the model's purpose. In object-oriented software, it's always a good idea to design your classes with a single responsability in the whole system. For example, it wouldn't make much sense to have a &lt;tt&gt;User&lt;/tt&gt; model with a method that writes data about a login attempt to a log file. Whenever you're using callbacks to write code that's not directly related to your model class purposes, it may be a good moment to create an Observer.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;An Active Record Observer is an object that links itself to a model and register it's methods for callbacks. Your model's implementation remain clean, while you can reuse the code in the Observer to add behaviuor to more than one model class. Ok, you may say that we can also do that using callback classes, but it would still force us to add code to our model's implementation.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Observer classes are subclasses of the &lt;tt&gt;ActiveRecord::Observer&lt;/tt&gt; class. When this class is subclassed, Active Record will look at the name of the new class and then strip the &lt;em&gt;Observer&lt;/em&gt; part to find the name of the Active Record class to observe.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Consider a &lt;tt&gt;Registration&lt;/tt&gt; model, where we want to send an email everytime a new registration is created. Since sending emails is not directly related to our model's purpose, we could create an Observer to do just that:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; RegistrationObserver &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Observer
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; after_create&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;model&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+    &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# code to send registration confirmation emails...&lt;/span&gt;&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Like in callback classes, the observer's methods receive the observed model as a parameter.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Sometimes using the ModelName + Observer naming convention won't be the best choice, mainly when you want to use the same observer for more than one model class. It's possible to explicity specify the models that our observer should observe.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; Auditor &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Observer
+  observe User&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; Registration&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; Invoice
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;h3 id=&quot;_registering_observers&quot;&gt;12.1. Registering observers&lt;/h3&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;If you payed attention, you may be wondering where Active Record Observers are referenced in our applications, so they get instantiate and begin to interact with our models. For observers to work we need to register then in our application's &lt;strong&gt;config/environment.rb&lt;/strong&gt; file. In this file there is a commented out line where we can define the observers that our application should load at start-up.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# Activate observers that should always be running&lt;/span&gt;&lt;/span&gt;
+config&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;active_record&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;observers &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;registration_observer&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;auditor
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;h3 id=&quot;_where_to_put_the_observers_source_files&quot;&gt;12.2. Where to put the observers' source files&lt;/h3&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;By convention, you should always save your observers' source files inside &lt;strong&gt;app/models&lt;/strong&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;/div&gt;
+&lt;h2 id=&quot;_changelog&quot;&gt;13. Changelog&lt;/h2&gt;
 &lt;div class=&quot;sectionbody&quot;&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;a href=&quot;http://rails.lighthouseapp.com/projects/16213/tickets/26-active-record-validations-and-callbacks&quot;&gt;http://rails.lighthouseapp.com/projects/16213/tickets/26-active-record-validations-and-callbacks&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
 &lt;/div&gt;</diff>
      <filename>railties/doc/guides/html/activerecord_validations_callbacks.html</filename>
    </modified>
    <modified>
      <diff>@@ -687,8 +687,8 @@ by Lorenzo Bettini
 http://www.lorenzobettini.it
 http://www.gnu.org/software/src-highlite --&gt;
 &lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; Employee &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Base
-  has_many &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;subordinates&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;class_name &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;User&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;foreign_key &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;manager_id&quot;&lt;/span&gt;
-  belongs_to &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;manager&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;class_name &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;User&quot;&lt;/span&gt;
+  has_many &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;subordinates&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;class_name &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;Employee&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;foreign_key &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;manager_id&quot;&lt;/span&gt;
+  belongs_to &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;manager&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;class_name &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;Employee&quot;&lt;/span&gt;
 &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;With this setup, you can retrieve &lt;tt&gt;@employee.subordinates&lt;/tt&gt; and &lt;tt&gt;@employee.manager&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;
@@ -742,7 +742,9 @@ customer&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;orders&lt;span style=&quot;color: #990000&quot;&gt;
 &lt;h3 id=&quot;_avoiding_name_collisions&quot;&gt;3.2. Avoiding Name Collisions&lt;/h3&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;You are not free to use just any name for your associations. Because creating an association adds a method with that name to the model, it is a bad idea to give an association a name that is already used for an instance method of &lt;tt&gt;ActiveRecord::Base&lt;/tt&gt;. The association method would override the base method and break things. For instance, &lt;tt&gt;attributes&lt;/tt&gt; or &lt;tt&gt;connection&lt;/tt&gt; are bad names for associations.&lt;/p&gt;&lt;/div&gt;
 &lt;h3 id=&quot;_updating_the_schema&quot;&gt;3.3. Updating the Schema&lt;/h3&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Associations are extremely useful, but they are not magic. You are responsible for maintaining your database schema to match your associations. In practice, this means two things. First, you need to create foreign keys as appropriate:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Associations are extremely useful, but they are not magic. You are responsible for maintaining your database schema to match your associations. In practice, this means two things, depending on what sort of associations you are creating. For &lt;tt&gt;belongs_to&lt;/tt&gt; associations you need to create foreign keys, and for &lt;tt&gt;has_and_belongs_to_many&lt;/tt&gt; associations you need to create the appropriate join table.&lt;/p&gt;&lt;/div&gt;
+&lt;h4 id=&quot;_creating_foreign_keys_for_tt_belongs_to_tt_associations&quot;&gt;3.3.1. Creating Foreign Keys for &lt;tt&gt;belongs_to&lt;/tt&gt; Associations&lt;/h4&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;When you declare a &lt;tt&gt;belongs_to&lt;/tt&gt; association, you need to create foreign keys as appropriate. For example, consider this model:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
 by Lorenzo Bettini
@@ -761,9 +763,9 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; CreateOrders &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Migration
   &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;self&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;up
     create_table &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;orders &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;t&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;
-      t&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;order_date   &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;datetime
-      t&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;order_number &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;string
-      t&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;customer_id  &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;integer
+      t&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;datetime   &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;order_date
+      t&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;string     &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;order_number
+      t&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;integer    &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;customer_id
     &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
   &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 
@@ -773,7 +775,8 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;If you create an association some time after you build the underlying model, you need to remember to create an &lt;tt&gt;add_column&lt;/tt&gt; migration to provide the necessary foreign key.&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Second, if you create a &lt;tt&gt;has_and_belongs_to_many&lt;/tt&gt; association, you need to explicitly create the joining table. Unless the name of the join table is explicitly specified by using the &lt;tt&gt;:join_table&lt;/tt&gt; option, Active Record create the name by using the lexical order of the class names. So a join between customer and order models will give the default join table name of &quot;customers_orders&quot; because &quot;c&quot; outranks &quot;o&quot; in lexical ordering.&lt;/p&gt;&lt;/div&gt;
+&lt;h4 id=&quot;_creating_join_tables_for_tt_has_and_belongs_to_many_tt_associations&quot;&gt;3.3.2. Creating Join Tables for &lt;tt&gt;has_and_belongs_to_many&lt;/tt&gt; Associations&lt;/h4&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;If you create a &lt;tt&gt;has_and_belongs_to_many&lt;/tt&gt; association, you need to explicitly create the joining table. Unless the name of the join table is explicitly specified by using the &lt;tt&gt;:join_table&lt;/tt&gt; option, Active Record create the name by using the lexical order of the class names. So a join between customer and order models will give the default join table name of &quot;customers_orders&quot; because &quot;c&quot; outranks &quot;o&quot; in lexical ordering.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;admonitionblock&quot;&gt;
 &lt;table&gt;&lt;tr&gt;
 &lt;td class=&quot;icon&quot;&gt;
@@ -1938,7 +1941,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;h5 id=&quot;_tt_offset_tt&quot;&gt;&lt;tt&gt;:offset&lt;/tt&gt;&lt;/h5&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The &lt;tt&gt;:offset&lt;/tt&gt; option lets you specify the starting offset for fetching objects via an association. For example, if you set &lt;tt&gt;:offset &amp;#8658; 11&lt;/tt&gt;, it will skip the first 10 records.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The &lt;tt&gt;:offset&lt;/tt&gt; option lets you specify the starting offset for fetching objects via an association. For example, if you set &lt;tt&gt;:offset &amp;#8658; 11&lt;/tt&gt;, it will skip the first 11 records.&lt;/p&gt;&lt;/div&gt;
 &lt;h5 id=&quot;_tt_order_tt_2&quot;&gt;&lt;tt&gt;:order&lt;/tt&gt;&lt;/h5&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;The &lt;tt&gt;:order&lt;/tt&gt; option dictates the order in which associated objects will be received (in the syntax used by a SQL &lt;tt&gt;ORDER BY&lt;/tt&gt; clause).&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
@@ -2409,7 +2412,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;h5 id=&quot;_tt_offset_tt_2&quot;&gt;&lt;tt&gt;:offset&lt;/tt&gt;&lt;/h5&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The &lt;tt&gt;:offset&lt;/tt&gt; option lets you specify the starting offset for fetching objects via an association. For example, if you set &lt;tt&gt;:offset &amp;#8658; 11&lt;/tt&gt;, it will skip the first 10 records.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The &lt;tt&gt;:offset&lt;/tt&gt; option lets you specify the starting offset for fetching objects via an association. For example, if you set &lt;tt&gt;:offset &amp;#8658; 11&lt;/tt&gt;, it will skip the first 11 records.&lt;/p&gt;&lt;/div&gt;
 &lt;h5 id=&quot;_tt_order_tt_3&quot;&gt;&lt;tt&gt;:order&lt;/tt&gt;&lt;/h5&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;The &lt;tt&gt;:order&lt;/tt&gt; option dictates the order in which associated objects will be received (in the syntax used by a SQL &lt;tt&gt;ORDER BY&lt;/tt&gt; clause).&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;</diff>
      <filename>railties/doc/guides/html/association_basics.html</filename>
    </modified>
    <modified>
      <diff>@@ -231,6 +231,11 @@ Heiko has rarely looked back.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;Tore Darell is an independent developer based in Menton, France who specialises in cruft-free web applications using Ruby, Rails
 and unobtrusive JavaScript. His home on the internet is his blog &lt;a href=&quot;http://tore.darell.no/&quot;&gt;Sneaky Abstractions&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;
 &lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;sidebarblock&quot; id=&quot;zilkey&quot;&gt;
+&lt;div class=&quot;sidebar-content&quot;&gt;
+&lt;div class=&quot;sidebar-title&quot;&gt;Jeff Dean&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Jeff Dean is a software engineer with &lt;a href=&quot;http://pivotallabs.com/&quot;&gt;Pivotal Labs&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;/div&gt;&lt;/div&gt;
 &lt;/div&gt;
 &lt;/div&gt;
 </diff>
      <filename>railties/doc/guides/html/authors.html</filename>
    </modified>
    <modified>
      <diff>@@ -217,6 +217,9 @@ ul#navMain {
 						&lt;/ul&gt;
 					&lt;/li&gt;
 					&lt;li&gt;
+					&lt;a href=&quot;#_conditional_get_support&quot;&gt;Conditional GET support&lt;/a&gt;
+					&lt;/li&gt;
+					&lt;li&gt;
 					&lt;a href=&quot;#_advanced_caching&quot;&gt;Advanced Caching&lt;/a&gt;
 					&lt;/li&gt;
 			&lt;/ol&gt;
@@ -235,8 +238,8 @@ need to return to those hungry web clients in the shortest time possible.&lt;/p&gt;&lt;/d
 &lt;div class=&quot;sectionbody&quot;&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;This is an introduction to the three types of caching techniques that Rails
 provides by default without the use of any third party plugins.&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;To get started make sure config.action_controller.perform_caching is set
-to true for your environment. This flag is normally set in the
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;To get started make sure &lt;tt&gt;config.action_controller.perform_caching&lt;/tt&gt; is set
+to &lt;tt&gt;true&lt;/tt&gt; for your environment. This flag is normally set in the
 corresponding config/environments/*.rb and caching is disabled by default
 there for development and test, and enabled for production.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
@@ -270,19 +273,19 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;The first time anyone requests products/index, Rails will generate a file
-called index.html and the webserver will then look for that file before it
+called &lt;tt&gt;index.html&lt;/tt&gt; and the webserver will then look for that file before it
 passes the next request for products/index to your Rails application.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;By default, the page cache directory is set to Rails.public_path (which is
-usually set to RAILS_ROOT + &quot;/public&quot;) and this can be configured by
-changing the configuration setting ActionController::Base.page_cache_directory. Changing the
-default from /public helps avoid naming conflicts, since you may want to
-put other static html in /public, but changing this will require web
-server reconfiguration to let the web server know where to serve the
-cached files from.&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The Page Caching mechanism will automatically add a .html exxtension to
+usually set to &lt;tt&gt;RAILS_ROOT + &quot;/public&quot;&lt;/tt&gt;) and this can be configured by
+changing the configuration setting &lt;tt&gt;config.action_controller.page_cache_directory&lt;/tt&gt;.
+Changing the default from /public helps avoid naming conflicts, since you may
+want to put other static html in /public, but changing this will require web
+server reconfiguration to let the web server know where to serve the cached
+files from.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The Page Caching mechanism will automatically add a &lt;tt&gt;.html&lt;/tt&gt; exxtension to
 requests for pages that do not have an extension to make it easy for the
 webserver to find those pages and this can be configured by changing the
-configuration setting ActionController::Base.page_cache_extension.&lt;/p&gt;&lt;/div&gt;
+configuration setting &lt;tt&gt;config.action_controller.page_cache_extension&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;In order to expire this page when a new product is added we could extend our
 example controler like this:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
@@ -337,8 +340,8 @@ http://www.gnu.org/software/src-highlite --&gt;
 
 &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;And you can also use :if (or :unless) to pass a Proc that specifies when the
-action should be cached. Also, you can use :layout &amp;#8658; false to cache without
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;And you can also use &lt;tt&gt;:if&lt;/tt&gt; (or &lt;tt&gt;:unless&lt;/tt&gt;) to pass a Proc that specifies when the
+action should be cached. Also, you can use &lt;tt&gt;:layout &amp;#8658; false&lt;/tt&gt; to cache without
 layout so that dynamic information in the layout such as logged in user info
 or the number of items in the cart can be left uncached. This feature is
 available as of Rails 2.2.&lt;/p&gt;&lt;/div&gt;
@@ -377,7 +380,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;The cache block in our example will bind to the action that called it and is
 written out to the same place as the Action Cache, which means that if you
-want to cache multiple fragments per action, you should provide an action_suffix to the cache call:&lt;/p&gt;&lt;/div&gt;
+want to cache multiple fragments per action, you should provide an &lt;tt&gt;action_suffix&lt;/tt&gt; to the cache call:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
 by Lorenzo Bettini
@@ -386,18 +389,38 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&amp;lt;% cache(:action =&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'recent'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;action_suffix &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'all_products'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;%&amp;gt;&lt;/span&gt;
   All available products&lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;and you can expire it using the expire_fragment method, like so:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;and you can expire it using the &lt;tt&gt;expire_fragment&lt;/tt&gt; method, like so:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;expire_fragment&lt;span style=&quot;color: #990000&quot;&gt;(:&lt;/span&gt;controller &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'products'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;action &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'recent'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;action_suffix &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; 'all_products&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;If you don't want the cache block to bind to the action that called it, You can
+also use globally keyed fragments by calling the cache method with a key, like
+so:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
 by Lorenzo Bettini
 http://www.lorenzobettini.it
 http://www.gnu.org/software/src-highlite --&gt;
-&lt;pre&gt;&lt;tt&gt;expire_fragment&lt;span style=&quot;color: #990000&quot;&gt;(:&lt;/span&gt;controller &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'producst'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;action &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'recent'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;action_suffix &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; 'all_products&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&amp;lt;% cache(:key =&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;'all_available_products'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #009900&quot;&gt;@latest_product&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;created_at&lt;span style=&quot;color: #990000&quot;&gt;].&lt;/span&gt;join&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;':'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;))&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;%&amp;gt;&lt;/span&gt;
+  All available products&lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;This fragment is then available to all actions in the ProductsController using
+the key and can be expired the same way:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;expire_fragment&lt;span style=&quot;color: #990000&quot;&gt;(:&lt;/span&gt;key &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;'all_available_products'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #009900&quot;&gt;@latest_product&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;created_at&lt;span style=&quot;color: #990000&quot;&gt;].&lt;/span&gt;join&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;':'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;))&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;h3 id=&quot;_sweepers&quot;&gt;1.4. Sweepers&lt;/h3&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;Cache sweeping is a mechanism which allows you to get around having a ton of
 expire_{page,action,fragment} calls in your code by moving all the work
-required to expire cached content into a ActionController::Caching::Sweeper
+required to expire cached content into a &lt;tt&gt;ActionController::Caching::Sweeper&lt;/tt&gt;
 class that is an Observer and looks for changes to an object via callbacks,
 and when a change occurs it expires the caches associated with that object n
 an around or after filter.&lt;/p&gt;&lt;/div&gt;
@@ -547,8 +570,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;pre&gt;&lt;tt&gt;ActionController&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Base&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;cache_store &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;drb_store&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;druby://localhost:9192&quot;&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;4) MemCached store: Works like DRbStore, but uses Danga's MemCache instead.
-                    Requires the ruby-memcache library:
-                    gem install ruby-memcache.&lt;/p&gt;&lt;/div&gt;
+                    Rails uses the bundled memcached-client gem by default.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
 by Lorenzo Bettini
@@ -564,8 +586,70 @@ http://www.lorenzobettini.it
 http://www.gnu.org/software/src-highlite --&gt;
 &lt;pre&gt;&lt;tt&gt;ActionController&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Base&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;cache_store &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; MyOwnStore&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;new&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;parameter&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;Note: config.cache_store can be used in place of
+ActionController::Base.cache_store in your Rails::Initializer.run block in
+environment.rb&lt;/tt&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;/div&gt;
+&lt;h2 id=&quot;_conditional_get_support&quot;&gt;2. Conditional GET support&lt;/h2&gt;
+&lt;div class=&quot;sectionbody&quot;&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Conditional GETs are a facility of the HTTP spec that provide a way for web
+servers to tell browsers that the response to a GET request hasn&#8217;t changed
+since the last request and can be safely pulled from the browser cache.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;They work by using the HTTP_IF_NONE_MATCH and HTTP_IF_MODIFIED_SINCE headers to
+pass back and forth both a unique content identifier and the timestamp of when
+the content was last changed. If the browser makes a request where the content
+identifier (etag) or last modified since timestamp matches the server&#8217;s version
+then the server only needs to send back an empty response with a not modified
+status.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;It is the server&#8217;s (i.e. our) responsibility to look for a last modified
+timestamp and the if-none-match header and determine whether or not to send
+back the full response. With conditional-get support in rails this is a pretty
+easy task:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; ProductsController &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; ApplicationController
+
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; show
+    &lt;span style=&quot;color: #009900&quot;&gt;@product&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; Product&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;find&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;params&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;id&lt;span style=&quot;color: #990000&quot;&gt;])&lt;/span&gt;
+
+    &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# If the request is stale according to the given timestamp and etag value&lt;/span&gt;&lt;/span&gt;
+    &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# (i.e. it needs to be processed again) then execute this block&lt;/span&gt;&lt;/span&gt;
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;if&lt;/span&gt;&lt;/span&gt; stale?&lt;span style=&quot;color: #990000&quot;&gt;(:&lt;/span&gt;last_modified &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #009900&quot;&gt;@product&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;updated_at&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;utc&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;etag &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #009900&quot;&gt;@product&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+      respond_to &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;wants&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;
+        &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# ... normal response processing&lt;/span&gt;&lt;/span&gt;
+      &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+    &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# If the request is fresh (i.e. it's not modified) then you don't need to do&lt;/span&gt;&lt;/span&gt;
+    &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# anything. The default render checks for this using the parameters&lt;/span&gt;&lt;/span&gt;
+    &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# used in the previous call to stale? and will automatically send a&lt;/span&gt;&lt;/span&gt;
+    &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# :not_modified.  So that's it, you're done.&lt;/span&gt;&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;If you don&#8217;t have any special response processing and are using the default
+rendering mechanism (i.e. you&#8217;re not using respond_to or calling render
+yourself) then you&#8217;ve got an easy helper in fresh_when:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; ProductsController &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; ApplicationController
+
+  &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# This will automatically send back a :not_modified if the request is fresh,&lt;/span&gt;&lt;/span&gt;
+  &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# and will render the default template (product.*) if it's stale.&lt;/span&gt;&lt;/span&gt;
+
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; show
+    &lt;span style=&quot;color: #009900&quot;&gt;@product&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; Product&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;find&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;params&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;id&lt;span style=&quot;color: #990000&quot;&gt;])&lt;/span&gt;
+    fresh_when &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;last_modified &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #009900&quot;&gt;@product&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;published_at&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;utc&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;etag &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #009900&quot;&gt;@article&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;/div&gt;
-&lt;h2 id=&quot;_advanced_caching&quot;&gt;2. Advanced Caching&lt;/h2&gt;
+&lt;h2 id=&quot;_advanced_caching&quot;&gt;3. Advanced Caching&lt;/h2&gt;
 &lt;div class=&quot;sectionbody&quot;&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;Along with the built-in mechanisms outlined above, a number of excellent
 plugins exist to help with finer grained control over caching. These include</diff>
      <filename>railties/doc/guides/html/caching_with_rails.html</filename>
    </modified>
    <modified>
      <diff>@@ -377,7 +377,7 @@ Installed Generators
 &lt;td class=&quot;icon&quot;&gt;
 &lt;img src=&quot;./images/icons/note.png&quot; alt=&quot;Note&quot; /&gt;
 &lt;/td&gt;
-&lt;td class=&quot;content&quot;&gt;All Rails console utilities have help text. For commands that require a lot of input to run correctly, you can just try the command without any parameters (like &lt;tt&gt;rails&lt;/tt&gt; or &lt;tt&gt;./script/generate&lt;/tt&gt;). For others, you can try adding &lt;tt&gt;&amp;#8212;help&lt;/tt&gt; or &lt;tt&gt;-h&lt;/tt&gt; to the end, as in &lt;tt&gt;./script/server &amp;#8212;help&lt;/tt&gt;.&lt;/td&gt;
+&lt;td class=&quot;content&quot;&gt;All Rails console utilities have help text. For commands that require a lot of input to run correctly, you can try the command without any parameters (like &lt;tt&gt;rails&lt;/tt&gt; or &lt;tt&gt;./script/generate&lt;/tt&gt;). For others, you can try adding &lt;tt&gt;&amp;#8212;help&lt;/tt&gt; or &lt;tt&gt;-h&lt;/tt&gt; to the end, as in &lt;tt&gt;./script/server &amp;#8212;help&lt;/tt&gt;.&lt;/td&gt;
 &lt;/tr&gt;&lt;/table&gt;
 &lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
@@ -425,7 +425,130 @@ http://www.gnu.org/software/src-highlite --&gt;
      create  app/helpers/greetings_helper&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;rb
      create  app/views/greetings/hello&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;html&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;erb
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Look there! Now what all did this generate? It looks like it made sure a bunch of directories were in our application, and created a controller file, a functional test file, a helper for the view, and a view file. All from one command!&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Look there! Now what all did this generate? It looks like it made sure a bunch of directories were in our application, and created a controller file, a functional test file, a helper for the view, and a view file.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Let's check out the controller and modify it a little (in &lt;tt&gt;app/controllers/greeting_controller.rb&lt;/tt&gt;):&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; GreetingController &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; ApplicationController
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; hello
+    &lt;span style=&quot;color: #009900&quot;&gt;@message&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;Hello, how are you today? I am exuberant!&quot;&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Then the view, to display our nice message (in &lt;tt&gt;app/views/greeting/hello.html.erb&lt;/tt&gt;):&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;lt;h1&amp;gt;&lt;/span&gt;&lt;/span&gt;A Greeting for You!&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;lt;p&amp;gt;&lt;/span&gt;&lt;/span&gt;&amp;lt;%= @message %&amp;gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;&amp;lt;/p&amp;gt;&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Deal. Go check it out in your browser. Fire up your server. Remember? &lt;tt&gt;./script/server&lt;/tt&gt; at the root of your Rails application should do it.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;$ &lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;/script/server
+&lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; Booting WEBrick&lt;span style=&quot;color: #990000&quot;&gt;...&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The URL will be &lt;tt&gt;http://localhost:3000/greetings/hello&lt;/tt&gt;. I'll wait for you to be suitably impressed.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;admonitionblock&quot;&gt;
+&lt;table&gt;&lt;tr&gt;
+&lt;td class=&quot;icon&quot;&gt;
+&lt;img src=&quot;./images/icons/note.png&quot; alt=&quot;Note&quot; /&gt;
+&lt;/td&gt;
+&lt;td class=&quot;content&quot;&gt;With a normal, plain-old Rails application, your URLs will generally follow the pattern of &lt;a href=&quot;http://(host)/(controller)/(action&quot;&gt;http://(host)/(controller)/(action&lt;/a&gt;), and a URL like &lt;a href=&quot;http://(host)/(controller&quot;&gt;http://(host)/(controller&lt;/a&gt;) will hit the &lt;strong&gt;index&lt;/strong&gt; action of that controller.&lt;/td&gt;
+&lt;/tr&gt;&lt;/table&gt;
+&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&quot;What about data, though?&quot;, you ask over a cup of coffee. Rails comes with a generator for data models too. Can you guess its generator name?&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;$ &lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;/script/generate model
+Usage&lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;/script/generate model ModelName &lt;span style=&quot;color: #990000&quot;&gt;[&lt;/span&gt;field&lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;type&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; field&lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;type&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;]&lt;/span&gt;
+
+&lt;span style=&quot;color: #990000&quot;&gt;...&lt;/span&gt;
+
+Examples&lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;
+    `&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;/script/generate model account`
+
+        creates an Account model&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;test&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; fixture&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; and migration&lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;
+            Model&lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;      app/models/account&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;rb
+            Test&lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;       test/unit/account_test&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;rb
+            Fixtures&lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;   test/fixtures/accounts&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;yml
+            Migration&lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;  db/migrate/XXX_add_accounts&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;rb
+
+    `&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;/script/generate model post title&lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;string body&lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;text published&lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;boolean`
+
+        creates a Post model with a string title&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; text body&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; and published flag&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Let's set up a simple model called &quot;HighScore&quot; that will keep track of our highest score on video games we play. Then we'll wire up our controller and view to modify and list our scores.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;$ &lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;/script/generate model HighScore id&lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;integer game&lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;string score&lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;integer
+      exists  app/models&lt;span style=&quot;color: #990000&quot;&gt;/&lt;/span&gt;
+      exists  test/unit&lt;span style=&quot;color: #990000&quot;&gt;/&lt;/span&gt;
+      exists  test/fixtures&lt;span style=&quot;color: #990000&quot;&gt;/&lt;/span&gt;
+      create  app/models/high_score&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;rb
+      create  test/unit/high_score_test&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;rb
+      create  test/fixtures/high_scores&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;yml
+      create  db/migrate
+      create  db/migrate&lt;span style=&quot;color: #990000&quot;&gt;/&lt;/span&gt;20081126032945_create_high_scores&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;rb
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Taking it from the top, we have the &lt;strong&gt;models&lt;/strong&gt; directory, where all of your data models live. &lt;strong&gt;test/unit&lt;/strong&gt;, where all the unit tests live (gasp! &amp;#8212; unit tests!), fixtures for those tests, a test, the &lt;strong&gt;migrate&lt;/strong&gt; directory, where the database-modifying migrations live, and a migration to create the &lt;tt&gt;high_scores&lt;/tt&gt; table with the right fields.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The migration requires that we &lt;strong&gt;migrate&lt;/strong&gt;, that is, run some Ruby code (living in that &lt;tt&gt;20081126032945_create_high_scores.rb&lt;/tt&gt;) to modify the schema of our database. Which database? The sqlite3 database that Rails will create for you when we run the &lt;tt&gt;rake db:migrate&lt;/tt&gt; command. We'll talk more about Rake in-depth in a little while.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;$ rake db&lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;migrate
+&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;in&lt;/span&gt;&lt;/span&gt; /home/commandsapp&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+&lt;span style=&quot;color: #990000&quot;&gt;==&lt;/span&gt;  CreateHighScores&lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt; migrating &lt;span style=&quot;color: #990000&quot;&gt;===============================================&lt;/span&gt;
+-- create_table&lt;span style=&quot;color: #990000&quot;&gt;(:&lt;/span&gt;high_scores&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+   -&lt;span style=&quot;color: #990000&quot;&gt;&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #993399&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;0070s
+&lt;span style=&quot;color: #990000&quot;&gt;==&lt;/span&gt;  CreateHighScores&lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt; migrated &lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #993399&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;0077s&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;======================================&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;admonitionblock&quot;&gt;
+&lt;table&gt;&lt;tr&gt;
+&lt;td class=&quot;icon&quot;&gt;
+&lt;img src=&quot;./images/icons/note.png&quot; alt=&quot;Note&quot; /&gt;
+&lt;/td&gt;
+&lt;td class=&quot;content&quot;&gt;Let's talk about unit tests. Unit tests are code that tests and makes assertions about code. In unit testing, we take a little part of code, say a method of a model, and test its inputs and outputs. Unit tests are your friend. The sooner you make peace with the fact that your quality of life will drastically increase when you unit test your code, the better. Seriously. We'll make one in a moment.&lt;/td&gt;
+&lt;/tr&gt;&lt;/table&gt;
+&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Yo! Let's shove a small table into our greeting controller and view, listing our sweet scores.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; GreetingController &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; ApplicationController
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; hello
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;if&lt;/span&gt;&lt;/span&gt; request&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;post?
+      score &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; HighScore&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;new&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;params&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;high_score&lt;span style=&quot;color: #990000&quot;&gt;])&lt;/span&gt;
+      &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;if&lt;/span&gt;&lt;/span&gt; score&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;save
+        flash&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;notice&lt;span style=&quot;color: #990000&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;New score posted!&quot;&lt;/span&gt;
+      &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+    &lt;span style=&quot;color: #009900&quot;&gt;@scores&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; HighScore&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;find&lt;span style=&quot;color: #990000&quot;&gt;(:&lt;/span&gt;all&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;XXX: Go with scaffolding instead, modifying greeting controller for high scores seems dumb.&lt;/p&gt;&lt;/div&gt;
 &lt;/div&gt;
 
 		&lt;/div&gt;</diff>
      <filename>railties/doc/guides/html/command_line.html</filename>
    </modified>
    <modified>
      <diff>@@ -205,6 +205,9 @@ ul#navMain {
 					&lt;a href=&quot;#_using_a_preinitializer&quot;&gt;Using a Preinitializer&lt;/a&gt;
 					&lt;/li&gt;
 					&lt;li&gt;
+					&lt;a href=&quot;#_initialization_process_settings&quot;&gt;Initialization Process Settings&lt;/a&gt;
+					&lt;/li&gt;
+					&lt;li&gt;
 					&lt;a href=&quot;#_configuring_rails_components&quot;&gt;Configuring Rails Components&lt;/a&gt;
 						&lt;ul&gt;
 						
@@ -220,6 +223,8 @@ ul#navMain {
 						
 							&lt;li&gt;&lt;a href=&quot;#_configuring_active_support&quot;&gt;Configuring Active Support&lt;/a&gt;&lt;/li&gt;
 						
+							&lt;li&gt;&lt;a href=&quot;#_configuring_active_model&quot;&gt;Configuring Active Model&lt;/a&gt;&lt;/li&gt;
+						
 						&lt;/ul&gt;
 					&lt;/li&gt;
 					&lt;li&gt;
@@ -229,6 +234,9 @@ ul#navMain {
 					&lt;a href=&quot;#_using_an_after_initializer&quot;&gt;Using an After-Initializer&lt;/a&gt;
 					&lt;/li&gt;
 					&lt;li&gt;
+					&lt;a href=&quot;#_rails_environment_settings&quot;&gt;Rails Environment Settings&lt;/a&gt;
+					&lt;/li&gt;
+					&lt;li&gt;
 					&lt;a href=&quot;#_changelog&quot;&gt;Changelog&lt;/a&gt;
 					&lt;/li&gt;
 			&lt;/ol&gt;
@@ -264,26 +272,156 @@ after-initializer&lt;/p&gt;&lt;/div&gt;
 &lt;h2 id=&quot;_using_a_preinitializer&quot;&gt;2. Using a Preinitializer&lt;/h2&gt;
 &lt;div class=&quot;sectionbody&quot;&gt;
 &lt;/div&gt;
-&lt;h2 id=&quot;_configuring_rails_components&quot;&gt;3. Configuring Rails Components&lt;/h2&gt;
+&lt;h2 id=&quot;_initialization_process_settings&quot;&gt;3. Initialization Process Settings&lt;/h2&gt;
 &lt;div class=&quot;sectionbody&quot;&gt;
-&lt;h3 id=&quot;_configuring_active_record&quot;&gt;3.1. Configuring Active Record&lt;/h3&gt;
-&lt;h3 id=&quot;_configuring_action_controller&quot;&gt;3.2. Configuring Action Controller&lt;/h3&gt;
-&lt;h3 id=&quot;_configuring_action_view&quot;&gt;3.3. Configuring Action View&lt;/h3&gt;
-&lt;h3 id=&quot;_configuring_action_mailer&quot;&gt;3.4. Configuring Action Mailer&lt;/h3&gt;
-&lt;h3 id=&quot;_configuring_active_resource&quot;&gt;3.5. Configuring Active Resource&lt;/h3&gt;
-&lt;h3 id=&quot;_configuring_active_support&quot;&gt;3.6. Configuring Active Support&lt;/h3&gt;
 &lt;/div&gt;
-&lt;h2 id=&quot;_using_initializers&quot;&gt;4. Using Initializers&lt;/h2&gt;
+&lt;h2 id=&quot;_configuring_rails_components&quot;&gt;4. Configuring Rails Components&lt;/h2&gt;
+&lt;div class=&quot;sectionbody&quot;&gt;
+&lt;h3 id=&quot;_configuring_active_record&quot;&gt;4.1. Configuring Active Record&lt;/h3&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;ActiveRecord::Base&lt;/tt&gt; includej a variety of configuration options:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;logger&lt;/tt&gt; accepts a logger conforming to the interface of Log4r or the default Ruby 1.8+ Logger class, which is then passed on to any new database connections made. You can retrieve this logger by calling &lt;tt&gt;logger&lt;/tt&gt; on either an ActiveRecord model class or an ActiveRecord model instance. Set to nil to disable logging.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;primary_key_prefix_type&lt;/tt&gt; lets you adjust the naming for primary key columns. By default, Rails assumes that primary key columns are named &lt;tt&gt;id&lt;/tt&gt; (and this configuration option doesn't need to be set.) There are two other choices:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;ilist&quot;&gt;&lt;ul&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;tt&gt;:table_name&lt;/tt&gt; would make the primary key for the Customer class &lt;tt&gt;customerid&lt;/tt&gt;
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;tt&gt;:table_name_with_underscore&lt;/tt&gt; would make the primary key for the Customer class &lt;tt&gt;customer_id&lt;/tt&gt;
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;/ul&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;table_name_prefix&lt;/tt&gt; lets you set a global string to be prepended to table names. If you set this to &lt;tt&gt;northwest_&lt;/tt&gt;, then the Customer class will look for &lt;tt&gt;northwest_customers&lt;/tt&gt; as its table. The default is an empty string.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;table_name_suffix&lt;/tt&gt; lets you set a global string to be appended to table names. If you set this to &lt;tt&gt;_northwest&lt;/tt&gt;, then the Customer class will look for &lt;tt&gt;customers_northwest&lt;/tt&gt; as its table. The default is an empty string.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;pluralize_table_names&lt;/tt&gt; specifies whether Rails will look for singular or plural table names in the database. If set to &lt;tt&gt;true&lt;/tt&gt; (the default), then the Customer class will use the &lt;tt&gt;customers&lt;/tt&gt; table. If set to &lt;tt&gt;false&lt;/tt&gt;, then the Customers class will use the &lt;tt&gt;customer&lt;/tt&gt; table.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;colorize_logging&lt;/tt&gt; (true by default) specifies whether or not to use ANSI color codes when logging information from ActiveRecord.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;default_timezone&lt;/tt&gt; determines whether to use &lt;tt&gt;Time.local&lt;/tt&gt; (if set to &lt;tt&gt;:local&lt;/tt&gt;) or &lt;tt&gt;Time.utc&lt;/tt&gt; (if set to &lt;tt&gt;:utc&lt;/tt&gt;) when pulling dates and times from the database. The default is &lt;tt&gt;:local&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;schema_format&lt;/tt&gt; controls the format for dumping the database schema to a file. The options are &lt;tt&gt;:ruby&lt;/tt&gt; (the default) for a database-independent version that depends on migrations, or &lt;tt&gt;:sql&lt;/tt&gt; for a set of (potentially database-dependent) SQL statements.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;timestamped_migrations&lt;/tt&gt; controls whether migrations are numbered with serial integers or with timestamps. The default is &lt;tt&gt;true&lt;/tt&gt;, to use timestamps, which are preferred if there are multiple developers working on the same application.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;lock_optimistically&lt;/tt&gt; controls whether ActiveRecord will use optimistic locking. By default this is &lt;tt&gt;true&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The MySQL adapter adds one additional configuration option:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;ActiveRecord::ConnectionAdapters::MysqlAdapter.emulate_booleans&lt;/tt&gt; controls whether ActiveRecord will consider all &lt;tt&gt;tinyint(1)&lt;/tt&gt; columns in a MySQL database to be booleans. By default this is &lt;tt&gt;true&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The schema dumper adds one additional configuration option:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;ActiveRecord::SchemaDumper.ignore_tables&lt;/tt&gt; accepts an array of tables that should &lt;em&gt;not&lt;/em&gt; be included in any generated schema file. This setting is ignored unless &lt;tt&gt;ActiveRecord::Base.schema_format == :ruby&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;h3 id=&quot;_configuring_action_controller&quot;&gt;4.2. Configuring Action Controller&lt;/h3&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;ActionController::Base includes a number of configuration settings:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;asset_host&lt;/tt&gt; provides a string that is prepended to all of the URL-generating helpers in &lt;tt&gt;AssetHelper&lt;/tt&gt;. This is designed to allow moving all javascript, CSS, and image files to a separate asset host.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;consider_all_requests_local&lt;/tt&gt; is generally set to &lt;tt&gt;true&lt;/tt&gt; during development and &lt;tt&gt;false&lt;/tt&gt; during production; if it is set to &lt;tt&gt;true&lt;/tt&gt;, then any error will cause detailed debugging information to be dumped in the HTTP response. For finer-grained control, set this to &lt;tt&gt;false&lt;/tt&gt; and implement &lt;tt&gt;local_request?&lt;/tt&gt; to specify which requests should provide debugging information on errors.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;allow_concurrency&lt;/tt&gt; should be set to &lt;tt&gt;true&lt;/tt&gt; to allow concurrent (threadsafe) action processing. Set to &lt;tt&gt;false&lt;/tt&gt; by default.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;param_parsers&lt;/tt&gt; provides an array of handlers that can extract information from incoming HTTP requests and add it to the &lt;tt&gt;params&lt;/tt&gt; hash. By default, parsers for multipart forms, URL-encoded forms, XML, and JSON are active.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;default_charset&lt;/tt&gt; specifies the default character set for all renders. The default is &quot;utf-8&quot;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;logger&lt;/tt&gt; accepts a logger conforming to the interface of Log4r or the default Ruby 1.8+ Logger class, which is then used to log information from Action Controller. Set to nil to disable logging.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;resource_action_separator&lt;/tt&gt; gives the token to be used between resources and actions when building or interpreting RESTful URLs. By default, this is &quot;/&quot;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;resource_path_names&lt;/tt&gt; is a hash of default names for several RESTful actions. By default, the new action is named &lt;tt&gt;new&lt;/tt&gt; and the edit action is named &lt;tt&gt;edit&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;request_forgery_protection_token&lt;/tt&gt; sets the token parameter name for RequestForgery. Calling &lt;tt&gt;protect_from_forgery&lt;/tt&gt; sets it to &lt;tt&gt;:authenticity_token&lt;/tt&gt; by default.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;optimise_named_routes&lt;/tt&gt; turns on some optimizations in generating the routing table. It is set to &lt;tt&gt;true&lt;/tt&gt; by default.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;use_accept_header&lt;/tt&gt; sets the rules for determining the response format. If this is set to &lt;tt&gt;true&lt;/tt&gt; (the default) then &lt;tt&gt;respond_to&lt;/tt&gt; and &lt;tt&gt;Request#format&lt;/tt&gt; will take the Accept header into account. If it is set to false then the request format will be determined solely by examining &lt;tt&gt;params[:format]&lt;/tt&gt;. If there is no &lt;tt&gt;format&lt;/tt&gt; parameter, then the response format will be either HTML or Javascript depending on whether the request is an AJAX request.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;allow_forgery_protection&lt;/tt&gt; enables or disables CSRF protection. By default this is &lt;tt&gt;false&lt;/tt&gt; in test mode and &lt;tt&gt;true&lt;/tt&gt; in all other modes.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;relative_url_root&lt;/tt&gt; can be used to tell Rails that you are deploying to a subdirectory. The default is &lt;tt&gt;ENV[&lt;em&gt;RAILS_RELATIVE_URL_ROOT&lt;/em&gt;]&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The caching code adds two additional settings:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;ActionController::Caching::Pages.page_cache_directory&lt;/tt&gt; sets the directory where Rails will create cached pages for your web server. The default is &lt;tt&gt;Rails.public_path&lt;/tt&gt; (which is usually set to &lt;tt&gt;RAILS_ROOT &lt;/tt&gt; &quot;/public&quot;+).&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;ActionController::Caching::Pages.page_cache_extension&lt;/tt&gt; sets the extension to be used when generating pages for the cache (this is ignored if the incoming request already has an extension). The default is &lt;tt&gt;.html&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The dispatcher includes one setting:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;ActionController::Dispatcher.error_file_path&lt;/tt&gt; gives the path where Rails will look for error files such as &lt;tt&gt;404.html&lt;/tt&gt;. The default is &lt;tt&gt;Rails.public_path&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The Active Record session store can also be configured:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;CGI::Session::ActiveRecordStore::Session.data_column_name&lt;/tt&gt; sets the name of the column to use to store session data. By default it is &lt;em&gt;data&lt;/em&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;h3 id=&quot;_configuring_action_view&quot;&gt;4.3. Configuring Action View&lt;/h3&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;There are only a few configuration options for Action View, starting with four on &lt;tt&gt;ActionView::Base&lt;/tt&gt;:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;debug_rjs&lt;/tt&gt; specifies whether RJS responses should be wrapped in a try/catch block that alert()s the caught exception (and then re-raises it). The default is &lt;tt&gt;false&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;warn_cache_misses&lt;/tt&gt; tells Rails to display a warning whenever an action results in a cache miss on your view paths. The default is &lt;tt&gt;false&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;default_form_builder&lt;/tt&gt; tells Rails which form builder to use by default. The default is &lt;tt&gt;ActionView::Helpers::FormBuilder&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The ERB template handler supplies one additional option:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;ActionView::TemplateHandlers::ERB.erb_trim_mode&lt;/tt&gt; gives the trim mode to be used by ERB. It defaults to &lt;tt&gt;&lt;em&gt;-&lt;/em&gt;&lt;/tt&gt;. See the &lt;a href=&quot;http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/&quot;&gt;ERB documentation&lt;/a&gt; for more information.&lt;/p&gt;&lt;/div&gt;
+&lt;h3 id=&quot;_configuring_action_mailer&quot;&gt;4.4. Configuring Action Mailer&lt;/h3&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;There are a number of settings available on &lt;tt&gt;ActionMailer::Base&lt;/tt&gt;:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;template_root&lt;/tt&gt; gives the root folder for Action Mailer templates.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;logger&lt;/tt&gt; accepts a logger conforming to the interface of Log4r or the default Ruby 1.8+ Logger class, which is then used to log information from Action Mailer. Set to nil to disable logging.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;smtp_settings&lt;/tt&gt; allows detailed configuration for the &lt;tt&gt;:smtp&lt;/tt&gt; delivery method. It accepts a hash of options, which can include any of these options:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;ilist&quot;&gt;&lt;ul&gt;
+&lt;li&gt;
+&lt;p&gt;
+&amp;lt;tt&amp;gt;:address&amp;lt;/tt&amp;gt; - Allows you to use a remote mail server. Just change it from its default &quot;localhost&quot; setting.
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+&amp;lt;tt&amp;gt;:port&amp;lt;/tt&amp;gt; - On the off chance that your mail server doesn't run on port 25, you can change it.
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+&amp;lt;tt&amp;gt;:domain&amp;lt;/tt&amp;gt; - If you need to specify a HELO domain, you can do it here.
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+&amp;lt;tt&amp;gt;:user_name&amp;lt;/tt&amp;gt; - If your mail server requires authentication, set the username in this setting.
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+&amp;lt;tt&amp;gt;:password&amp;lt;/tt&amp;gt; - If your mail server requires authentication, set the password in this setting.
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+&amp;lt;tt&amp;gt;:authentication&amp;lt;/tt&amp;gt; - If your mail server requires authentication, you need to specify the authentication type here. This is a symbol and one of &amp;lt;tt&amp;gt;:plain&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;:login&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;:cram_md5&amp;lt;/tt&amp;gt;.
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;/ul&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;sendmail_settings&lt;/tt&gt; allows detailed configuration for the &lt;tt&gt;sendmail&lt;/tt&gt; delivery method. It accepts a hash of options, which can include any of these options:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;ilist&quot;&gt;&lt;ul&gt;
+&lt;li&gt;
+&lt;p&gt;
+&amp;lt;tt&amp;gt;:location&amp;lt;/tt&amp;gt; - The location of the sendmail executable. Defaults to &amp;lt;tt&amp;gt;/usr/sbin/sendmail&amp;lt;/tt&amp;gt;.
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+&amp;lt;tt&amp;gt;:arguments&amp;lt;/tt&amp;gt; - The command line arguments. Defaults to &amp;lt;tt&amp;gt;-i -t&amp;lt;/tt&amp;gt;.
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;/ul&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;raise_delivery_errors&lt;/tt&gt; specifies whether to raise an error if email delivery cannot be completed. It defaults to &lt;tt&gt;true&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;delivery_method&lt;/tt&gt; defines the delivery method. The allowed values are &amp;lt;tt&amp;gt;:smtp&amp;lt;/tt&amp;gt; (default), &amp;lt;tt&amp;gt;:sendmail&amp;lt;/tt&amp;gt;, and &amp;lt;tt&amp;gt;:test&amp;lt;/tt&amp;gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;perform_deliveries&lt;/tt&gt; specifies whether mail will actually be delivered. By default this is &lt;tt&gt;true&lt;/tt&gt;; it can be convenient to set it to &lt;tt&gt;false&lt;/tt&gt; for testing.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;default_charset&lt;/tt&gt; tells Action Mailer which character set to use for the body and for encoding the subject. It defaults to &lt;tt&gt;utf-8&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;default_content_type&lt;/tt&gt; specifies the default content type used for the main part of the message. It defaults to &quot;text/plain&quot;&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;default_mime_version&lt;/tt&gt; is the default MIME version for the message. It defaults to &lt;tt&gt;1.0&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;default_implicit_parts_order&lt;/tt&gt; - 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
+&amp;lt;tt&amp;gt;[&quot;text/html&quot;, &quot;text/enriched&quot;, &quot;text/plain&quot;]&amp;lt;/tt&amp;gt;. Items that appear first in the array have higher priority in the mail client
+and appear last in the mime encoded message.&lt;/p&gt;&lt;/div&gt;
+&lt;h3 id=&quot;_configuring_active_resource&quot;&gt;4.5. Configuring Active Resource&lt;/h3&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;There is a single configuration setting available on &lt;tt&gt;ActiveResource::Base&lt;/tt&gt;:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;logger&lt;/tt&gt; accepts a logger conforming to the interface of Log4r or the default Ruby 1.8+ Logger class, which is then used to log information from Active Resource. Set to nil to disable logging.&lt;/p&gt;&lt;/div&gt;
+&lt;h3 id=&quot;_configuring_active_support&quot;&gt;4.6. Configuring Active Support&lt;/h3&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;There are a few configuration options available in Active Support:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;ActiveSupport::BufferedLogger.silencer&lt;/tt&gt; is set to &lt;tt&gt;false&lt;/tt&gt; to disable the ability to silence logging in a block. The default is &lt;tt&gt;true&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;ActiveSupport::Cache::Store.logger&lt;/tt&gt; specifies the logger to use within cache store operations.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;ActiveSupport::Logger.silencer&lt;/tt&gt; is set to &lt;tt&gt;false&lt;/tt&gt; to disable the ability to silence logging in a block. The default is &lt;tt&gt;true&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;h3 id=&quot;_configuring_active_model&quot;&gt;4.7. Configuring Active Model&lt;/h3&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Active Model currently has a single configuration setting:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;+ActiveModel::Errors.default_error_messages is an array containing all of the validation error messages.&lt;/p&gt;&lt;/div&gt;
+&lt;/div&gt;
+&lt;h2 id=&quot;_using_initializers&quot;&gt;5. Using Initializers&lt;/h2&gt;
 &lt;div class=&quot;sectionbody&quot;&gt;
 &lt;div class=&quot;literalblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;
 &lt;pre&gt;&lt;tt&gt;organization, controlling load order&lt;/tt&gt;&lt;/pre&gt;
 &lt;/div&gt;&lt;/div&gt;
 &lt;/div&gt;
-&lt;h2 id=&quot;_using_an_after_initializer&quot;&gt;5. Using an After-Initializer&lt;/h2&gt;
+&lt;h2 id=&quot;_using_an_after_initializer&quot;&gt;6. Using an After-Initializer&lt;/h2&gt;
 &lt;div class=&quot;sectionbody&quot;&gt;
 &lt;/div&gt;
-&lt;h2 id=&quot;_changelog&quot;&gt;6. Changelog&lt;/h2&gt;
+&lt;h2 id=&quot;_rails_environment_settings&quot;&gt;7. Rails Environment Settings&lt;/h2&gt;
+&lt;div class=&quot;sectionbody&quot;&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;ENV&lt;/p&gt;&lt;/div&gt;
+&lt;/div&gt;
+&lt;h2 id=&quot;_changelog&quot;&gt;8. Changelog&lt;/h2&gt;
 &lt;div class=&quot;sectionbody&quot;&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;a href=&quot;http://rails.lighthouseapp.com/projects/16213-rails-guides/tickets/28&quot;&gt;Lighthouse ticket&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;ilist&quot;&gt;&lt;ul&gt;
@@ -291,145 +429,15 @@ after-initializer&lt;/p&gt;&lt;/div&gt;
 &lt;p&gt;
 November 5, 2008: Rough outline by &lt;a href=&quot;../authors.html#mgunderloy&quot;&gt;Mike Gunderloy&lt;/a&gt;
 &lt;/p&gt;
+&lt;div class=&quot;qlist&quot;&gt;&lt;ol&gt;
+&lt;li&gt;
+&lt;p&gt;&lt;em&gt;
+need to look for def self. ?
+&lt;/em&gt;&lt;/p&gt;
+&lt;/li&gt;
+&lt;/ol&gt;&lt;/div&gt;
 &lt;/li&gt;
 &lt;/ul&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;actionmailer/lib/action_mailer/base.rb
-257:    cattr_accessor :logger
-267:    cattr_accessor :smtp_settings
-273:    cattr_accessor :sendmail_settings
-276:    cattr_accessor :raise_delivery_errors
-282:    cattr_accessor :perform_deliveries
-285:    cattr_accessor :deliveries
-288:    cattr_accessor :default_charset
-291:    cattr_accessor :default_content_type
-294:    cattr_accessor :default_mime_version
-297:    cattr_accessor :default_implicit_parts_order
-299:    cattr_reader :protected_instance_variables&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;actionmailer/Rakefile
-36:  rdoc.options &amp;lt;&amp;lt; &lt;em&gt;&amp;#8212;line-numbers&lt;/em&gt; &amp;lt;&amp;lt; &lt;em&gt;&amp;#8212;inline-source&lt;/em&gt; &amp;lt;&amp;lt; &lt;em&gt;-A cattr_accessor=object&lt;/em&gt;&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;actionpack/lib/action_controller/base.rb
-263:    cattr_reader :protected_instance_variables
-273:    cattr_accessor :asset_host
-279:    cattr_accessor :consider_all_requests_local
-285:    cattr_accessor :allow_concurrency
-317:    cattr_accessor :param_parsers
-321:    cattr_accessor :default_charset
-325:    cattr_accessor :logger
-329:    cattr_accessor :resource_action_separator
-333:    cattr_accessor :resources_path_names
-337:    cattr_accessor :request_forgery_protection_token
-341:    cattr_accessor :optimise_named_routes
-351:    cattr_accessor :use_accept_header
-361:    cattr_accessor :relative_url_root&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;actionpack/lib/action_controller/caching/pages.rb
-55:          cattr_accessor :page_cache_directory
-58:          cattr_accessor :page_cache_extension&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;actionpack/lib/action_controller/caching.rb
-37:        cattr_reader :cache_store
-48:        cattr_accessor :perform_caching&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;actionpack/lib/action_controller/dispatcher.rb
-98:    cattr_accessor :error_file_path&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;actionpack/lib/action_controller/mime_type.rb
-24:    cattr_reader :html_types, :unverifiable_types&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;actionpack/lib/action_controller/rescue.rb
-36:      base.cattr_accessor :rescue_responses
-40:      base.cattr_accessor :rescue_templates&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;actionpack/lib/action_controller/session/active_record_store.rb
-60:        cattr_accessor :data_column_name
-170:        cattr_accessor :connection
-173:        cattr_accessor :table_name
-177:        cattr_accessor :session_id_column
-181:        cattr_accessor :data_column
-282:      cattr_accessor :session_class&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;actionpack/lib/action_controller/vendor/html-scanner/html/sanitizer.rb
-44:    cattr_accessor :included_tags, :instance_writer &amp;#8658; false&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;actionpack/lib/action_view/base.rb
-189:    cattr_accessor :debug_rjs
-193:    cattr_accessor :warn_cache_misses&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;actionpack/lib/action_view/helpers/active_record_helper.rb
-7:    cattr_accessor :field_error_proc&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;actionpack/lib/action_view/helpers/form_helper.rb
-805:    cattr_accessor :default_form_builder&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;actionpack/lib/action_view/template_handlers/erb.rb
-47:      cattr_accessor :erb_trim_mode&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;actionpack/test/active_record_unit.rb
-5:  cattr_accessor :able_to_connect
-6:  cattr_accessor :connected&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;actionpack/test/controller/filters_test.rb
-286:    cattr_accessor :execution_log&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;actionpack/test/template/form_options_helper_test.rb
-3:TZInfo::Timezone.cattr_reader :loaded_zones&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;activemodel/lib/active_model/errors.rb
-28:    cattr_accessor :default_error_messages&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;activemodel/Rakefile
-19:  rdoc.options &amp;lt;&amp;lt; &lt;em&gt;&amp;#8212;line-numbers&lt;/em&gt; &amp;lt;&amp;lt; &lt;em&gt;&amp;#8212;inline-source&lt;/em&gt; &amp;lt;&amp;lt; &lt;em&gt;-A cattr_accessor=object&lt;/em&gt;&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;activerecord/lib/active_record/attribute_methods.rb
-9:      base.cattr_accessor :attribute_types_cached_by_default, :instance_writer &amp;#8658; false
-11:      base.cattr_accessor :time_zone_aware_attributes, :instance_writer &amp;#8658; false&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;activerecord/lib/active_record/base.rb
-394:    cattr_accessor :logger, :instance_writer &amp;#8658; false
-443:    cattr_accessor :configurations, :instance_writer &amp;#8658; false
-450:    cattr_accessor :primary_key_prefix_type, :instance_writer &amp;#8658; false
-456:    cattr_accessor :table_name_prefix, :instance_writer &amp;#8658; false
-461:    cattr_accessor :table_name_suffix, :instance_writer &amp;#8658; false
-467:    cattr_accessor :pluralize_table_names, :instance_writer &amp;#8658; false
-473:    cattr_accessor :colorize_logging, :instance_writer &amp;#8658; false
-478:    cattr_accessor :default_timezone, :instance_writer &amp;#8658; false
-487:    cattr_accessor :schema_format , :instance_writer &amp;#8658; false
-491:    cattr_accessor :timestamped_migrations , :instance_writer &amp;#8658; false&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb
-11:    cattr_accessor :connection_handler, :instance_writer &amp;#8658; false&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
-166:      cattr_accessor :emulate_booleans&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;activerecord/lib/active_record/fixtures.rb
-498:  cattr_accessor :all_loaded_fixtures&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;activerecord/lib/active_record/locking/optimistic.rb
-38:        base.cattr_accessor :lock_optimistically, :instance_writer &amp;#8658; false&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;activerecord/lib/active_record/migration.rb
-259:    cattr_accessor :verbose&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;activerecord/lib/active_record/schema_dumper.rb
-13:    cattr_accessor :ignore_tables&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;activerecord/lib/active_record/serializers/json_serializer.rb
-4:      base.cattr_accessor :include_root_in_json, :instance_writer &amp;#8658; false&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;activerecord/Rakefile
-142:  rdoc.options &amp;lt;&amp;lt; &lt;em&gt;&amp;#8212;line-numbers&lt;/em&gt; &amp;lt;&amp;lt; &lt;em&gt;&amp;#8212;inline-source&lt;/em&gt; &amp;lt;&amp;lt; &lt;em&gt;-A cattr_accessor=object&lt;/em&gt;&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;activerecord/test/cases/lifecycle_test.rb
-61:  cattr_reader :last_inherited&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;activerecord/test/cases/mixin_test.rb
-9:  cattr_accessor :forced_now_time&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;activeresource/lib/active_resource/base.rb
-206:    cattr_accessor :logger&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;activeresource/Rakefile
-43:  rdoc.options &amp;lt;&amp;lt; &lt;em&gt;&amp;#8212;line-numbers&lt;/em&gt; &amp;lt;&amp;lt; &lt;em&gt;&amp;#8212;inline-source&lt;/em&gt; &amp;lt;&amp;lt; &lt;em&gt;-A cattr_accessor=object&lt;/em&gt;&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;activesupport/lib/active_support/buffered_logger.rb
-17:    cattr_accessor :silencer&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;activesupport/lib/active_support/cache.rb
-81:      cattr_accessor :logger&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;activesupport/lib/active_support/core_ext/class/attribute_accessors.rb
-5:#    cattr_accessor :hair_colors
-10:  def cattr_reader(*syms)
-29:  def cattr_writer(*syms)
-50:  def cattr_accessor(*syms)
-51:    cattr_reader(*syms)
-52:    cattr_writer(*syms)&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;activesupport/lib/active_support/core_ext/logger.rb
-34:  cattr_accessor :silencer&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;activesupport/test/core_ext/class/attribute_accessor_test.rb
-6:      cattr_accessor :foo
-7:      cattr_accessor :bar, :instance_writer &amp;#8658; false&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;activesupport/test/core_ext/module/synchronization_test.rb
-6:    @target.cattr_accessor :mutex, :instance_writer &amp;#8658; false&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;railties/doc/guides/html/creating_plugins.html
-786:      cattr_accessor &amp;lt;span style=&quot;color: #990000&quot;&amp;gt;:&amp;lt;/span&amp;gt;yaffle_text_field&amp;lt;span style=&quot;color: #990000&quot;&amp;gt;,&amp;lt;/span&amp;gt; &amp;lt;span style=&quot;color: #990000&quot;&amp;gt;:&amp;lt;/span&amp;gt;yaffle_date_field
-860:      cattr_accessor &amp;lt;span style=&quot;color: #990000&quot;&amp;gt;:&amp;lt;/span&amp;gt;yaffle_text_field&amp;lt;span style=&quot;color: #990000&quot;&amp;gt;,&amp;lt;/span&amp;gt; &amp;lt;span style=&quot;color: #990000&quot;&amp;gt;:&amp;lt;/span&amp;gt;yaffle_date_field&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;railties/lib/rails_generator/base.rb
-93:      cattr_accessor :logger&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;railties/Rakefile
-265:  rdoc.options &amp;lt;&amp;lt; &lt;em&gt;&amp;#8212;line-numbers&lt;/em&gt; &amp;lt;&amp;lt; &lt;em&gt;&amp;#8212;inline-source&lt;/em&gt; &amp;lt;&amp;lt; &lt;em&gt;&amp;#8212;accessor&lt;/em&gt; &amp;lt;&amp;lt; &lt;em&gt;cattr_accessor=object&lt;/em&gt;&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;railties/test/rails_info_controller_test.rb
-12:    cattr_accessor :local_request&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Rakefile
-32:  rdoc.options &amp;lt;&amp;lt; &lt;em&gt;-A cattr_accessor=object&lt;/em&gt;&lt;/p&gt;&lt;/div&gt;
 &lt;/div&gt;
 
 		&lt;/div&gt;</diff>
      <filename>railties/doc/guides/html/configuring.html</filename>
    </modified>
    <modified>
      <diff>@@ -199,14 +199,22 @@ ul#navMain {
 			&lt;h2&gt;Chapters&lt;/h2&gt;
 			&lt;ol&gt;
 					&lt;li&gt;
-					&lt;a href=&quot;#_preparation&quot;&gt;Preparation&lt;/a&gt;
+					&lt;a href=&quot;#_setup&quot;&gt;Setup&lt;/a&gt;
 						&lt;ul&gt;
 						
 							&lt;li&gt;&lt;a href=&quot;#_create_the_basic_app&quot;&gt;Create the basic app&lt;/a&gt;&lt;/li&gt;
 						
 							&lt;li&gt;&lt;a href=&quot;#_generate_the_plugin_skeleton&quot;&gt;Generate the plugin skeleton&lt;/a&gt;&lt;/li&gt;
 						
-							&lt;li&gt;&lt;a href=&quot;#_setup_the_plugin_for_testing&quot;&gt;Setup the plugin for testing&lt;/a&gt;&lt;/li&gt;
+							&lt;li&gt;&lt;a href=&quot;#_organize_your_files&quot;&gt;Organize your files&lt;/a&gt;&lt;/li&gt;
+						
+						&lt;/ul&gt;
+					&lt;/li&gt;
+					&lt;li&gt;
+					&lt;a href=&quot;#_tests&quot;&gt;Tests&lt;/a&gt;
+						&lt;ul&gt;
+						
+							&lt;li&gt;&lt;a href=&quot;#_test_setup&quot;&gt;Test Setup&lt;/a&gt;&lt;/li&gt;
 						
 							&lt;li&gt;&lt;a href=&quot;#_run_the_plugin_tests&quot;&gt;Run the plugin tests&lt;/a&gt;&lt;/li&gt;
 						
@@ -216,16 +224,12 @@ ul#navMain {
 					&lt;a href=&quot;#_extending_core_classes&quot;&gt;Extending core classes&lt;/a&gt;
 						&lt;ul&gt;
 						
-							&lt;li&gt;&lt;a href=&quot;#_creating_the_test&quot;&gt;Creating the test&lt;/a&gt;&lt;/li&gt;
-						
-							&lt;li&gt;&lt;a href=&quot;#_organize_your_files&quot;&gt;Organize your files&lt;/a&gt;&lt;/li&gt;
-						
 							&lt;li&gt;&lt;a href=&quot;#_working_with_init_rb&quot;&gt;Working with init.rb&lt;/a&gt;&lt;/li&gt;
 						
 						&lt;/ul&gt;
 					&lt;/li&gt;
 					&lt;li&gt;
-					&lt;a href=&quot;#_add_an_tt_acts_as_yaffle_tt_method_to_active_record&quot;&gt;Add an &lt;tt&gt;acts_as_yaffle&lt;/tt&gt; method to Active Record&lt;/a&gt;
+					&lt;a href=&quot;#_add_an_em_acts_as_em_method_to_active_record&quot;&gt;Add an &lt;em&gt;acts_as&lt;/em&gt; method to Active Record&lt;/a&gt;
 						&lt;ul&gt;
 						
 							&lt;li&gt;&lt;a href=&quot;#_add_a_class_method&quot;&gt;Add a class method&lt;/a&gt;&lt;/li&gt;
@@ -235,56 +239,59 @@ ul#navMain {
 						&lt;/ul&gt;
 					&lt;/li&gt;
 					&lt;li&gt;
-					&lt;a href=&quot;#_create_a_generator&quot;&gt;Create a generator&lt;/a&gt;
-						&lt;ul&gt;
-						
-							&lt;li&gt;&lt;a href=&quot;#_testing_generators&quot;&gt;Testing generators&lt;/a&gt;&lt;/li&gt;
-						
-							&lt;li&gt;&lt;a href=&quot;#_adding_to_the_manifest&quot;&gt;Adding to the manifest&lt;/a&gt;&lt;/li&gt;
-						
-							&lt;li&gt;&lt;a href=&quot;#_manually_test_the_generator&quot;&gt;Manually test the generator&lt;/a&gt;&lt;/li&gt;
-						
-							&lt;li&gt;&lt;a href=&quot;#_the_usage_file&quot;&gt;The USAGE file&lt;/a&gt;&lt;/li&gt;
-						
-						&lt;/ul&gt;
+					&lt;a href=&quot;#_models&quot;&gt;Models&lt;/a&gt;
 					&lt;/li&gt;
 					&lt;li&gt;
-					&lt;a href=&quot;#_add_a_custom_generator_command&quot;&gt;Add a custom generator command&lt;/a&gt;
+					&lt;a href=&quot;#_controllers&quot;&gt;Controllers&lt;/a&gt;
 					&lt;/li&gt;
 					&lt;li&gt;
-					&lt;a href=&quot;#_add_a_model&quot;&gt;Add a model&lt;/a&gt;
+					&lt;a href=&quot;#_helpers&quot;&gt;Helpers&lt;/a&gt;
 					&lt;/li&gt;
 					&lt;li&gt;
-					&lt;a href=&quot;#_add_a_controller&quot;&gt;Add a controller&lt;/a&gt;
+					&lt;a href=&quot;#_routes&quot;&gt;Routes&lt;/a&gt;
 					&lt;/li&gt;
 					&lt;li&gt;
-					&lt;a href=&quot;#_add_a_helper&quot;&gt;Add a helper&lt;/a&gt;
+					&lt;a href=&quot;#_generators&quot;&gt;Generators&lt;/a&gt;
+						&lt;ul&gt;
+						
+							&lt;li&gt;&lt;a href=&quot;#_testing_generators&quot;&gt;Testing generators&lt;/a&gt;&lt;/li&gt;
+						
+							&lt;li&gt;&lt;a href=&quot;#_the_usage_file&quot;&gt;The USAGE file&lt;/a&gt;&lt;/li&gt;
+						
+						&lt;/ul&gt;
 					&lt;/li&gt;
 					&lt;li&gt;
-					&lt;a href=&quot;#_add_a_custom_route&quot;&gt;Add a Custom Route&lt;/a&gt;
+					&lt;a href=&quot;#_generator_commands&quot;&gt;Generator Commands&lt;/a&gt;
 					&lt;/li&gt;
 					&lt;li&gt;
-					&lt;a href=&quot;#_odds_and_ends&quot;&gt;Odds and ends&lt;/a&gt;
+					&lt;a href=&quot;#_migrations&quot;&gt;Migrations&lt;/a&gt;
 						&lt;ul&gt;
 						
-							&lt;li&gt;&lt;a href=&quot;#_generate_rdoc_documentation&quot;&gt;Generate RDoc Documentation&lt;/a&gt;&lt;/li&gt;
-						
-							&lt;li&gt;&lt;a href=&quot;#_write_custom_rake_tasks_in_your_plugin&quot;&gt;Write custom Rake tasks in your plugin&lt;/a&gt;&lt;/li&gt;
-						
-							&lt;li&gt;&lt;a href=&quot;#_store_plugins_in_alternate_locations&quot;&gt;Store plugins in alternate locations&lt;/a&gt;&lt;/li&gt;
+							&lt;li&gt;&lt;a href=&quot;#_create_a_custom_rake_task&quot;&gt;Create a custom rake task&lt;/a&gt;&lt;/li&gt;
 						
-							&lt;li&gt;&lt;a href=&quot;#_create_your_own_plugin_loaders_and_plugin_locators&quot;&gt;Create your own Plugin Loaders and Plugin Locators&lt;/a&gt;&lt;/li&gt;
+							&lt;li&gt;&lt;a href=&quot;#_call_migrations_directly&quot;&gt;Call migrations directly&lt;/a&gt;&lt;/li&gt;
 						
-							&lt;li&gt;&lt;a href=&quot;#_use_custom_plugin_generators&quot;&gt;Use Custom Plugin Generators&lt;/a&gt;&lt;/li&gt;
+							&lt;li&gt;&lt;a href=&quot;#_generate_migrations&quot;&gt;Generate migrations&lt;/a&gt;&lt;/li&gt;
 						
 						&lt;/ul&gt;
 					&lt;/li&gt;
 					&lt;li&gt;
+					&lt;a href=&quot;#_rake_tasks&quot;&gt;Rake tasks&lt;/a&gt;
+					&lt;/li&gt;
+					&lt;li&gt;
+					&lt;a href=&quot;#_plugingems&quot;&gt;PluginGems&lt;/a&gt;
+					&lt;/li&gt;
+					&lt;li&gt;
+					&lt;a href=&quot;#_rdoc_documentation&quot;&gt;RDoc Documentation&lt;/a&gt;
+					&lt;/li&gt;
+					&lt;li&gt;
 					&lt;a href=&quot;#_appendix&quot;&gt;Appendix&lt;/a&gt;
 						&lt;ul&gt;
 						
 							&lt;li&gt;&lt;a href=&quot;#_references&quot;&gt;References&lt;/a&gt;&lt;/li&gt;
 						
+							&lt;li&gt;&lt;a href=&quot;#_contents_of_em_lib_yaffle_rb_em&quot;&gt;Contents of &lt;em&gt;lib/yaffle.rb&lt;/em&gt;&lt;/a&gt;&lt;/li&gt;
+						
 							&lt;li&gt;&lt;a href=&quot;#_final_plugin_directory_structure&quot;&gt;Final plugin directory structure&lt;/a&gt;&lt;/li&gt;
 						
 						&lt;/ul&gt;
@@ -388,7 +395,7 @@ A custom route method that can be used in routes.rb
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;For the purpose of this guide pretend for a moment that you are an avid bird watcher.  Your favorite bird is the Yaffle, and you want to create a plugin that allows other developers to share in the Yaffle goodness.  First, you need to get setup for development.&lt;/p&gt;&lt;/div&gt;
 &lt;/div&gt;
 &lt;/div&gt;
-&lt;h2 id=&quot;_preparation&quot;&gt;1. Preparation&lt;/h2&gt;
+&lt;h2 id=&quot;_setup&quot;&gt;1. Setup&lt;/h2&gt;
 &lt;div class=&quot;sectionbody&quot;&gt;
 &lt;h3 id=&quot;_create_the_basic_app&quot;&gt;1.1. Create the basic app&lt;/h3&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;The examples in this guide require that you have a working rails application.  To create a simple rails app execute:&lt;/p&gt;&lt;/div&gt;
@@ -447,10 +454,30 @@ create  vendor/plugins/yaffle/generators/yaffle/templates
 create  vendor/plugins/yaffle/generators/yaffle/yaffle_generator.rb
 create  vendor/plugins/yaffle/generators/yaffle/USAGE&lt;/tt&gt;&lt;/pre&gt;
 &lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;To begin just change one thing - move &lt;em&gt;init.rb&lt;/em&gt; to &lt;em&gt;rails/init.rb&lt;/em&gt;.&lt;/p&gt;&lt;/div&gt;
-&lt;h3 id=&quot;_setup_the_plugin_for_testing&quot;&gt;1.3. Setup the plugin for testing&lt;/h3&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;If your plugin interacts with a database, you'll need to setup a database connection.  In this guide you will learn how to test your plugin against multiple different database adapters using Active Record.  This guide will not cover how to use fixtures in plugin tests.&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;To setup your plugin to allow for easy testing you'll need to add 3 files:&lt;/p&gt;&lt;/div&gt;
+&lt;h3 id=&quot;_organize_your_files&quot;&gt;1.3. Organize your files&lt;/h3&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;To make it easy to organize your files and to make the plugin more compatible with GemPlugins, start out by altering your file system to look like this:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;
+&lt;pre&gt;&lt;tt&gt;|-- lib
+|   |-- yaffle
+|   `-- yaffle.rb
+`-- rails
+    |
+    `-- init.rb&lt;/tt&gt;&lt;/pre&gt;
+&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/rails/init.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'yaffle'&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Now you can add any &lt;em&gt;require&lt;/em&gt; statements to &lt;em&gt;lib/yaffle.rb&lt;/em&gt; and keep &lt;em&gt;init.rb&lt;/em&gt; clean.&lt;/p&gt;&lt;/div&gt;
+&lt;/div&gt;
+&lt;h2 id=&quot;_tests&quot;&gt;2. Tests&lt;/h2&gt;
+&lt;div class=&quot;sectionbody&quot;&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;In this guide you will learn how to test your plugin against multiple different database adapters using Active Record.  To setup your plugin to allow for easy testing you'll need to add 3 files:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;ilist&quot;&gt;&lt;ul&gt;
 &lt;li&gt;
 &lt;p&gt;
@@ -468,6 +495,7 @@ A test helper method that sets up the database
 &lt;/p&gt;
 &lt;/li&gt;
 &lt;/ul&gt;&lt;/div&gt;
+&lt;h3 id=&quot;_test_setup&quot;&gt;2.1. Test Setup&lt;/h3&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/test/database.yml:&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;
@@ -558,7 +586,7 @@ ENV&lt;span style=&quot;color: #990000&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;'RAILS_ROOT
 &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;Now whenever you write a test that requires the database, you can call &lt;em&gt;load_schema&lt;/em&gt;.&lt;/p&gt;&lt;/div&gt;
-&lt;h3 id=&quot;_run_the_plugin_tests&quot;&gt;1.4. Run the plugin tests&lt;/h3&gt;
+&lt;h3 id=&quot;_run_the_plugin_tests&quot;&gt;2.2. Run the plugin tests&lt;/h3&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;Once you have these files in place, you can write your first test to ensure that your plugin-testing setup is correct.  By default rails generates a file in &lt;em&gt;vendor/plugins/yaffle/test/yaffle_test.rb&lt;/em&gt; with a sample test.  Replace the contents of that file with:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/test/yaffle_test.rb:&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
@@ -619,22 +647,9 @@ rake DB=postgresql&lt;/tt&gt;&lt;/pre&gt;
 &lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;Now you are ready to test-drive your plugin!&lt;/p&gt;&lt;/div&gt;
 &lt;/div&gt;
-&lt;h2 id=&quot;_extending_core_classes&quot;&gt;2. Extending core classes&lt;/h2&gt;
+&lt;h2 id=&quot;_extending_core_classes&quot;&gt;3. Extending core classes&lt;/h2&gt;
 &lt;div class=&quot;sectionbody&quot;&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;This section will explain how to add a method to String that will be available anywhere in your rails app by:&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;ilist&quot;&gt;&lt;ul&gt;
-&lt;li&gt;
-&lt;p&gt;
-Writing tests for the desired behavior
-&lt;/p&gt;
-&lt;/li&gt;
-&lt;li&gt;
-&lt;p&gt;
-Creating and requiring the correct files
-&lt;/p&gt;
-&lt;/li&gt;
-&lt;/ul&gt;&lt;/div&gt;
-&lt;h3 id=&quot;_creating_the_test&quot;&gt;2.1. Creating the test&lt;/h3&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;This section will explain how to add a method to String that will be available anywhere in your rails app.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;In this example you will add a method to String named &lt;tt&gt;to_squawk&lt;/tt&gt;.  To begin, create a new test file with a few assertions:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/test/core_ext_test.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
@@ -665,24 +680,6 @@ NoMethodError: undefined method `to_squawk' for &quot;Hello World&quot;:String
     ./test/core_ext_test.rb:5:in `test_to_squawk_prepends_the_word_squawk'&lt;/tt&gt;&lt;/pre&gt;
 &lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;Great - now you are ready to start development.&lt;/p&gt;&lt;/div&gt;
-&lt;h3 id=&quot;_organize_your_files&quot;&gt;2.2. Organize your files&lt;/h3&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;A common pattern in rails plugins is to set up the file structure like this:&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;listingblock&quot;&gt;
-&lt;div class=&quot;content&quot;&gt;
-&lt;pre&gt;&lt;tt&gt;|-- lib
-|   |-- yaffle
-|   |   `-- core_ext.rb
-|   `-- yaffle.rb&lt;/tt&gt;&lt;/pre&gt;
-&lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The first thing we need to to is to require our &lt;em&gt;lib/yaffle.rb&lt;/em&gt; file from &lt;em&gt;rails/init.rb&lt;/em&gt;:&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/rails/init.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;listingblock&quot;&gt;
-&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite --&gt;
-&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'yaffle'&lt;/span&gt;
-&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;Then in &lt;em&gt;lib/yaffle.rb&lt;/em&gt; require &lt;em&gt;lib/core_ext.rb&lt;/em&gt;:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/lib/yaffle.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
@@ -712,11 +709,11 @@ http://www.gnu.org/software/src-highlite --&gt;
 &amp;gt;&amp;gt; &quot;Hello World&quot;.to_squawk
 =&amp;gt; &quot;squawk! Hello World&quot;&lt;/tt&gt;&lt;/pre&gt;
 &lt;/div&gt;&lt;/div&gt;
-&lt;h3 id=&quot;_working_with_init_rb&quot;&gt;2.3. Working with init.rb&lt;/h3&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;When rails loads plugins it looks for the file named init.rb.  However, when the plugin is initialized, &lt;em&gt;init.rb&lt;/em&gt; is invoked via &lt;tt&gt;eval&lt;/tt&gt; (not &lt;tt&gt;require&lt;/tt&gt;) so it has slightly different behavior.&lt;/p&gt;&lt;/div&gt;
+&lt;h3 id=&quot;_working_with_init_rb&quot;&gt;3.1. Working with init.rb&lt;/h3&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;When rails loads plugins it looks for the file named &lt;em&gt;init.rb&lt;/em&gt; or &lt;em&gt;rails/init.rb&lt;/em&gt;.  However, when the plugin is initialized, &lt;em&gt;init.rb&lt;/em&gt; is invoked via &lt;tt&gt;eval&lt;/tt&gt; (not &lt;tt&gt;require&lt;/tt&gt;) so it has slightly different behavior.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;Under certain circumstances if you reopen classes or modules in &lt;em&gt;init.rb&lt;/em&gt; you may inadvertently create a new class, rather than reopening an existing class.  A better alternative is to reopen the class in a different file, and require that file from &lt;tt&gt;init.rb&lt;/tt&gt;, as shown above.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;If you must reopen a class in &lt;tt&gt;init.rb&lt;/tt&gt; you can use &lt;tt&gt;module_eval&lt;/tt&gt; or &lt;tt&gt;class_eval&lt;/tt&gt; to avoid any issues:&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/init.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/rails/init.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
 by Lorenzo Bettini
@@ -729,7 +726,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;Another way is to explicitly define the top-level module space for all modules and classes, like &lt;tt&gt;::Hash&lt;/tt&gt;:&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/init.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/rails/init.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
 by Lorenzo Bettini
@@ -742,7 +739,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;/div&gt;
-&lt;h2 id=&quot;_add_an_tt_acts_as_yaffle_tt_method_to_active_record&quot;&gt;3. Add an &lt;tt&gt;acts_as_yaffle&lt;/tt&gt; method to Active Record&lt;/h2&gt;
+&lt;h2 id=&quot;_add_an_em_acts_as_em_method_to_active_record&quot;&gt;4. Add an &lt;em&gt;acts_as&lt;/em&gt; method to Active Record&lt;/h2&gt;
 &lt;div class=&quot;sectionbody&quot;&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;A common pattern in plugins is to add a method called &lt;em&gt;acts_as_something&lt;/em&gt; to models.  In this case, you want to write a method called &lt;em&gt;acts_as_yaffle&lt;/em&gt; that adds a &lt;em&gt;squawk&lt;/em&gt; method to your models.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;To begin, set up your files so that you have:&lt;/p&gt;&lt;/div&gt;
@@ -801,7 +798,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;With structure you can easily separate the methods that will be used for the class (like &lt;tt&gt;Hickwall.some_method&lt;/tt&gt;) and the instance (like &lt;tt&gt;@hickwell.some_method&lt;/tt&gt;).&lt;/p&gt;&lt;/div&gt;
-&lt;h3 id=&quot;_add_a_class_method&quot;&gt;3.1. Add a class method&lt;/h3&gt;
+&lt;h3 id=&quot;_add_a_class_method&quot;&gt;4.1. Add a class method&lt;/h3&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;This plugin will expect that you've added a method to your model named &lt;em&gt;last_squawk&lt;/em&gt;.  However, the plugin users might have already defined a method on their model named &lt;em&gt;last_squawk&lt;/em&gt; that they use for something else.  This plugin will allow the name to be changed by adding a class method called &lt;em&gt;yaffle_text_field&lt;/em&gt;.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;To start out, write a failing test that shows the behavior you'd like:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/test/acts_as_yaffle_test.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
@@ -854,7 +851,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 
 ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Base&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;send &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;include&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; Yaffle
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
-&lt;h3 id=&quot;_add_an_instance_method&quot;&gt;3.2. Add an instance method&lt;/h3&gt;
+&lt;h3 id=&quot;_add_an_instance_method&quot;&gt;4.2. Add an instance method&lt;/h3&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;This plugin will add a method named &lt;em&gt;squawk&lt;/em&gt; to any Active Record objects that call &lt;em&gt;acts_as_yaffle&lt;/em&gt;.  The &lt;em&gt;squawk&lt;/em&gt; method will simply set the value of one of the fields in the database.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;To start out, write a failing test that shows the behavior you'd like:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/test/acts_as_yaffle_test.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
@@ -936,267 +933,7 @@ ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Base&lt;span style=&quot;color: #99000
 &lt;/tr&gt;&lt;/table&gt;
 &lt;/div&gt;
 &lt;/div&gt;
-&lt;h2 id=&quot;_create_a_generator&quot;&gt;4. Create a generator&lt;/h2&gt;
-&lt;div class=&quot;sectionbody&quot;&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Many plugins ship with generators.  When you created the plugin above, you specified the &amp;#8212;with-generator option, so you already have the generator stubs in &lt;em&gt;vendor/plugins/yaffle/generators/yaffle&lt;/em&gt;.&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Building generators is a complex topic unto itself and this section will cover one small aspect of generators:  creating a generator that adds a time-stamped migration.&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;To create a generator you must:&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;ilist&quot;&gt;&lt;ul&gt;
-&lt;li&gt;
-&lt;p&gt;
-Add your instructions to the &lt;em&gt;manifest&lt;/em&gt; method of the generator
-&lt;/p&gt;
-&lt;/li&gt;
-&lt;li&gt;
-&lt;p&gt;
-Add any necessary template files to the templates directory
-&lt;/p&gt;
-&lt;/li&gt;
-&lt;li&gt;
-&lt;p&gt;
-Test the generator manually by running various combinations of &lt;tt&gt;script/generate&lt;/tt&gt; and &lt;tt&gt;script/destroy&lt;/tt&gt;
-&lt;/p&gt;
-&lt;/li&gt;
-&lt;li&gt;
-&lt;p&gt;
-Update the USAGE file to add helpful documentation for your generator
-&lt;/p&gt;
-&lt;/li&gt;
-&lt;/ul&gt;&lt;/div&gt;
-&lt;h3 id=&quot;_testing_generators&quot;&gt;4.1. Testing generators&lt;/h3&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Many rails plugin authors do not test their generators, however testing generators is quite simple.  A typical generator test does the following:&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;ilist&quot;&gt;&lt;ul&gt;
-&lt;li&gt;
-&lt;p&gt;
-Creates a new fake rails root directory that will serve as destination
-&lt;/p&gt;
-&lt;/li&gt;
-&lt;li&gt;
-&lt;p&gt;
-Runs the generator forward and backward, making whatever assertions are necessary
-&lt;/p&gt;
-&lt;/li&gt;
-&lt;li&gt;
-&lt;p&gt;
-Removes the fake rails root
-&lt;/p&gt;
-&lt;/li&gt;
-&lt;/ul&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;For the generator in this section, the test could look something like this:&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/test/yaffle_generator_test.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;listingblock&quot;&gt;
-&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite --&gt;
-&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;dirname&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;__FILE__&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'/test_helper.rb'&lt;/span&gt;
-&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'rails_generator'&lt;/span&gt;
-&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'rails_generator/scripts/generate'&lt;/span&gt;
-&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'rails_generator/scripts/destroy'&lt;/span&gt;
-
-&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; GeneratorTest &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; Test&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Unit&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;TestCase
-
-  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; fake_rails_root
-    File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;join&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;dirname&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;__FILE__&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;),&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'rails_root'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
-  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-
-  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; file_list
-    Dir&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;glob&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;join&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;fake_rails_root&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;db&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;migrate&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;*&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;))&lt;/span&gt;
-  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-
-  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; setup
-    FileUtils&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;mkdir_p&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;fake_rails_root&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
-    &lt;span style=&quot;color: #009900&quot;&gt;@original_files&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; file_list
-  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-
-  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; teardown
-    FileUtils&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;rm_r&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;fake_rails_root&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
-  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-
-  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; test_generates_correct_file_name
-    Rails&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Scripts&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generate&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;new&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;run&lt;span style=&quot;color: #990000&quot;&gt;([&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;yaffle&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;bird&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;],&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;destination &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; fake_rails_root&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
-    new_file &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;file_list &lt;span style=&quot;color: #990000&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color: #009900&quot;&gt;@original_files&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;).&lt;/span&gt;first
-    assert_match &lt;span style=&quot;color: #FF6600&quot;&gt;/add_yaffle_fields_to_bird/&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; new_file
-  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-
-&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;You can run &lt;em&gt;rake&lt;/em&gt; from the plugin directory to see this fail.  Unless you are doing more advanced generator commands it typically suffices to just test the Generate script, and trust that rails will handle the Destroy and Update commands for you.&lt;/p&gt;&lt;/div&gt;
-&lt;h3 id=&quot;_adding_to_the_manifest&quot;&gt;4.2. Adding to the manifest&lt;/h3&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;This example will demonstrate how to use one of the built-in generator methods named &lt;em&gt;migration_template&lt;/em&gt; to create a migration file.  To start, update your generator file to look like this:&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/generators/yaffle/yaffle_generator.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;listingblock&quot;&gt;
-&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite --&gt;
-&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; YaffleGenerator &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; Rails&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;NamedBase
-  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; manifest
-    record &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;m&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;
-      m&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;migration_template &lt;span style=&quot;color: #FF0000&quot;&gt;'migration:migration.rb'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;db/migrate&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;assigns &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; yaffle_local_assigns&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;
-        &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;migration_file_name &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;add_yaffle_fields_to_#{custom_file_name}&quot;&lt;/span&gt;
-      &lt;span style=&quot;color: #FF0000&quot;&gt;}&lt;/span&gt;
-    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-
-  private
-    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; custom_file_name
-      custom_name &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; class_name&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;underscore&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;downcase
-      custom_name &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; custom_name&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;pluralize &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;if&lt;/span&gt;&lt;/span&gt; ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Base&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;pluralize_table_names
-    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-
-    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; yaffle_local_assigns
-      returning&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;assigns &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;{}&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt;
-        assigns&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;migration_action&lt;span style=&quot;color: #990000&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;add&quot;&lt;/span&gt;
-        assigns&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;class_name&lt;span style=&quot;color: #990000&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;add_yaffle_fields_to_#{custom_file_name}&quot;&lt;/span&gt;
-        assigns&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;table_name&lt;span style=&quot;color: #990000&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; custom_file_name
-        assigns&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;attributes&lt;span style=&quot;color: #990000&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;[&lt;/span&gt;Rails&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;GeneratedAttribute&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;new&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;last_squawk&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;string&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)]&lt;/span&gt;
-      &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The generator creates a new file in &lt;em&gt;db/migrate&lt;/em&gt; with a timestamp and an &lt;em&gt;add_column&lt;/em&gt; statement.  It reuses the built in rails &lt;tt&gt;migration_template&lt;/tt&gt; method, and reuses the built-in rails migration template.&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;It's courteous to check to see if table names are being pluralized whenever you create a generator that needs to be aware of table names.  This way people using your generator won't have to manually change the generated files if they've turned pluralization off.&lt;/p&gt;&lt;/div&gt;
-&lt;h3 id=&quot;_manually_test_the_generator&quot;&gt;4.3. Manually test the generator&lt;/h3&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;To run the generator, type the following at the command line:&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;listingblock&quot;&gt;
-&lt;div class=&quot;content&quot;&gt;
-&lt;pre&gt;&lt;tt&gt;./script/generate yaffle bird&lt;/tt&gt;&lt;/pre&gt;
-&lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;and you will see a new file:&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;db/migrate/20080529225649_add_yaffle_fields_to_birds.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;listingblock&quot;&gt;
-&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite --&gt;
-&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; AddYaffleFieldsToBirds &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Migration
-  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;self&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;up
-    add_column &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;birds&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;last_squawk&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;string
-  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-
-  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;self&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;down
-    remove_column &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;birds&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;last_squawk
-  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
-&lt;h3 id=&quot;_the_usage_file&quot;&gt;4.4. The USAGE file&lt;/h3&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Rails ships with several built-in generators.  You can see all of the generators available to you by typing the following at the command line:&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;listingblock&quot;&gt;
-&lt;div class=&quot;content&quot;&gt;
-&lt;pre&gt;&lt;tt&gt;script/generate&lt;/tt&gt;&lt;/pre&gt;
-&lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;You should see something like this:&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;listingblock&quot;&gt;
-&lt;div class=&quot;content&quot;&gt;
-&lt;pre&gt;&lt;tt&gt;Installed Generators
-  Plugins (vendor/plugins): yaffle
-  Builtin: controller, integration_test, mailer, migration, model, observer, plugin, resource, scaffold, session_migration&lt;/tt&gt;&lt;/pre&gt;
-&lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;When you run &lt;tt&gt;script/generate yaffle&lt;/tt&gt; you should see the contents of your &lt;em&gt;vendor/plugins/yaffle/generators/yaffle/USAGE&lt;/em&gt; file.&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;For this plugin, update the USAGE file looks like this:&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;listingblock&quot;&gt;
-&lt;div class=&quot;content&quot;&gt;
-&lt;pre&gt;&lt;tt&gt;Description:
-    Creates a migration that adds yaffle squawk fields to the given model
-
-Example:
-    ./script/generate yaffle hickwall
-
-    This will create:
-        db/migrate/TIMESTAMP_add_yaffle_fields_to_hickwall&lt;/tt&gt;&lt;/pre&gt;
-&lt;/div&gt;&lt;/div&gt;
-&lt;/div&gt;
-&lt;h2 id=&quot;_add_a_custom_generator_command&quot;&gt;5. Add a custom generator command&lt;/h2&gt;
-&lt;div class=&quot;sectionbody&quot;&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;You may have noticed above that you can used one of the built-in rails migration commands &lt;tt&gt;migration_template&lt;/tt&gt;.  If your plugin needs to add and remove lines of text from existing files you will need to write your own generator methods.&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;This section describes how you you can create your own commands to add and remove a line of text from &lt;em&gt;routes.rb&lt;/em&gt;.  This example creates a very simple method that adds or removes a text file.&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;To start, add the following test method:&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/test/generator_test.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;listingblock&quot;&gt;
-&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite --&gt;
-&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; test_generates_definition
-  Rails&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Scripts&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generate&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;new&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;run&lt;span style=&quot;color: #990000&quot;&gt;([&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;yaffle&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;bird&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;],&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;destination &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; fake_rails_root&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
-  definition &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;read&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;join&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;fake_rails_root&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;definition.txt&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;))&lt;/span&gt;
-  assert_match &lt;span style=&quot;color: #FF6600&quot;&gt;/Yaffle\:/&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; definition
-&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Run &lt;tt&gt;rake&lt;/tt&gt; to watch the test fail, then make the test pass add the following:&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/generators/yaffle/templates/definition.txt&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;listingblock&quot;&gt;
-&lt;div class=&quot;content&quot;&gt;
-&lt;pre&gt;&lt;tt&gt;Yaffle: A bird&lt;/tt&gt;&lt;/pre&gt;
-&lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/lib/yaffle.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;listingblock&quot;&gt;
-&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite --&gt;
-&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;yaffle/commands&quot;&lt;/span&gt;
-&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/lib/commands.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;listingblock&quot;&gt;
-&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite --&gt;
-&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'rails_generator'&lt;/span&gt;
-&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'rails_generator/commands'&lt;/span&gt;
-
-&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;module&lt;/span&gt;&lt;/span&gt; Yaffle &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;#:nodoc:&lt;/span&gt;&lt;/span&gt;
-  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;module&lt;/span&gt;&lt;/span&gt; Generator &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;#:nodoc:&lt;/span&gt;&lt;/span&gt;
-    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;module&lt;/span&gt;&lt;/span&gt; Commands &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;#:nodoc:&lt;/span&gt;&lt;/span&gt;
-      &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;module&lt;/span&gt;&lt;/span&gt; Create
-        &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; yaffle_definition
-          file&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;definition.txt&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;definition.txt&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
-        &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-      &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-
-      &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;module&lt;/span&gt;&lt;/span&gt; Destroy
-        &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; yaffle_definition
-          file&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;definition.txt&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;definition.txt&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
-        &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-      &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-
-      &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;module&lt;/span&gt;&lt;/span&gt; List
-        &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; yaffle_definition
-          file&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;definition.txt&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;definition.txt&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
-        &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-      &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-
-      &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;module&lt;/span&gt;&lt;/span&gt; Update
-        &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; yaffle_definition
-          file&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;definition.txt&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;definition.txt&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
-        &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-      &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-
-Rails&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Commands&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Create&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;send   &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;include&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;  Yaffle&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Commands&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Create
-Rails&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Commands&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Destroy&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;send  &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;include&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;  Yaffle&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Commands&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Destroy
-Rails&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Commands&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;List&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;send     &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;include&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;  Yaffle&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Commands&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;List
-Rails&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Commands&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Update&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;send   &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;include&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;  Yaffle&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Commands&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Update
-&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Finally, call your new method in the manifest:&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/generators/yaffle/yaffle_generator.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;listingblock&quot;&gt;
-&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite --&gt;
-&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; YaffleGenerator &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; Rails&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;NamedBase
-  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; manifest
-    m&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;yaffle_definition
-  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
-&lt;/div&gt;
-&lt;h2 id=&quot;_add_a_model&quot;&gt;6. Add a model&lt;/h2&gt;
+&lt;h2 id=&quot;_models&quot;&gt;5. Models&lt;/h2&gt;
 &lt;div class=&quot;sectionbody&quot;&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;This section describes how to add a model named &lt;em&gt;Woodpecker&lt;/em&gt; to your plugin that will behave the same as a model in your main app.  When storing models, controllers, views and helpers in your plugin, it's customary to keep them in directories that match the rails directories.  For this example, create a file structure like this:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
@@ -1263,19 +1000,17 @@ http://www.gnu.org/software/src-highlite --&gt;
 by Lorenzo Bettini
 http://www.lorenzobettini.it
 http://www.gnu.org/software/src-highlite --&gt;
-&lt;pre&gt;&lt;tt&gt;ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Schema&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;define&lt;span style=&quot;color: #990000&quot;&gt;(:&lt;/span&gt;version &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #993399&quot;&gt;0&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt;
-  create_table &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;woodpeckers&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;force &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;true&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;t&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;
-    t&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;string &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;name
-  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;pre&gt;&lt;tt&gt;create_table &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;woodpeckers&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;force &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;true&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;t&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;
+  t&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;string &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;name
 &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;Now your test should be passing, and you should be able to use the Woodpecker model from within your rails app, and any changes made to it are reflected immediately when running in development mode.&lt;/p&gt;&lt;/div&gt;
 &lt;/div&gt;
-&lt;h2 id=&quot;_add_a_controller&quot;&gt;7. Add a controller&lt;/h2&gt;
+&lt;h2 id=&quot;_controllers&quot;&gt;6. Controllers&lt;/h2&gt;
 &lt;div class=&quot;sectionbody&quot;&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;This section describes how to add a controller named &lt;em&gt;woodpeckers&lt;/em&gt; to your plugin that will behave the same as a controller in your main app.  This is very similar to adding a model.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;You can test your plugin's controller as you would test any other controller:&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/yaffle/woodpeckers_controller_test.rb:&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/test/woodpeckers_controller_test.rb:&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
 by Lorenzo Bettini
@@ -1292,6 +1027,10 @@ http://www.gnu.org/software/src-highlite --&gt;
     &lt;span style=&quot;color: #009900&quot;&gt;@controller&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; WoodpeckersController&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;new
     &lt;span style=&quot;color: #009900&quot;&gt;@request&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; ActionController&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;TestRequest&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;new
     &lt;span style=&quot;color: #009900&quot;&gt;@response&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; ActionController&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;TestResponse&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;new
+
+    ActionController&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Routing&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Routes&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;draw &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;map&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;
+      map&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;resources &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;woodpeckers
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
   &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 
   &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; test_index
@@ -1330,7 +1069,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;Now your test should be passing, and you should be able to use the Woodpeckers controller in your app.  If you add a route for the woodpeckers controller you can start up your server and go to &lt;a href=&quot;http://localhost:3000/woodpeckers&quot;&gt;http://localhost:3000/woodpeckers&lt;/a&gt; to see your controller in action.&lt;/p&gt;&lt;/div&gt;
 &lt;/div&gt;
-&lt;h2 id=&quot;_add_a_helper&quot;&gt;8. Add a helper&lt;/h2&gt;
+&lt;h2 id=&quot;_helpers&quot;&gt;7. Helpers&lt;/h2&gt;
 &lt;div class=&quot;sectionbody&quot;&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;This section describes how to add a helper named &lt;em&gt;WoodpeckersHelper&lt;/em&gt; to your plugin that will behave the same as a helper in your main app.  This is very similar to adding a model and a controller.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;You can test your plugin's helper as you would test any other helper:&lt;/p&gt;&lt;/div&gt;
@@ -1362,8 +1101,6 @@ http://www.gnu.org/software/src-highlite --&gt;
   ActiveSupport&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Dependencies&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;load_paths &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; path
   ActiveSupport&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Dependencies&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;load_once_paths&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;delete&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;path&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
 &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
-
-ActionView&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Base&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;send &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;include&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; WoodpeckersHelper
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/lib/app/helpers/woodpeckers_helper.rb:&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
@@ -1381,9 +1118,10 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;Now your test should be passing, and you should be able to use the Woodpeckers helper in your app.&lt;/p&gt;&lt;/div&gt;
 &lt;/div&gt;
-&lt;h2 id=&quot;_add_a_custom_route&quot;&gt;9. Add a Custom Route&lt;/h2&gt;
+&lt;h2 id=&quot;_routes&quot;&gt;8. Routes&lt;/h2&gt;
 &lt;div class=&quot;sectionbody&quot;&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Testing routes in plugins can be complex, especially if the controllers are also in the plugin itself.  Jamis Buck showed a great example of this in &lt;a href=&quot;http://weblog.jamisbuck.org/2006/10/26/monkey-patching-rails-extending-routes-2&quot;&gt;http://weblog.jamisbuck.org/2006/10/26/monkey-patching-rails-extending-routes-2&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;In a standard &lt;em&gt;routes.rb&lt;/em&gt; file you use routes like &lt;em&gt;map.connect&lt;/em&gt; or &lt;em&gt;map.resources&lt;/em&gt;.  You can add your own custom routes from a plugin.  This section will describe how to add a custom method called that can be called with &lt;em&gt;map.yaffles&lt;/em&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Testing routes from plugins is slightly different from testing routes in a standard rails app.  To begin, add a test like this:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/test/routing_test.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
@@ -1406,26 +1144,22 @@ http://www.gnu.org/software/src-highlite --&gt;
 
   private
 
-    &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# yes, I know about assert_recognizes, but it has proven problematic to&lt;/span&gt;&lt;/span&gt;
-    &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# use in these tests, since it uses RouteSet#recognize (which actually&lt;/span&gt;&lt;/span&gt;
-    &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# tries to instantiate the controller) and because it uses an awkward&lt;/span&gt;&lt;/span&gt;
-    &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# parameter order.&lt;/span&gt;&lt;/span&gt;
     &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; assert_recognition&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;method&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; path&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; options&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
       result &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; ActionController&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Routing&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Routes&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;recognize_path&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;path&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;method &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; method&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
       assert_equal options&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; result
     &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/init.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Once you see the tests fail by running &lt;em&gt;rake&lt;/em&gt;, you can make them pass with:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/lib/yaffle.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
 by Lorenzo Bettini
 http://www.lorenzobettini.it
 http://www.gnu.org/software/src-highlite --&gt;
-&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;routing&quot;&lt;/span&gt;
-ActionController&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Routing&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;RouteSet&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Mapper&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;send &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;include&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; Yaffle&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Routing&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;MapperExtensions
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;yaffle/routing&quot;&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/lib/routing.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/lib/yaffle/routing.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
 by Lorenzo Bettini
@@ -1440,6 +1174,8 @@ http://www.gnu.org/software/src-highlite --&gt;
     &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
   &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+ActionController&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Routing&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;RouteSet&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Mapper&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;send &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;include&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; Yaffle&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Routing&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;MapperExtensions
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;config/routes.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
@@ -1448,47 +1184,498 @@ by Lorenzo Bettini
 http://www.lorenzobettini.it
 http://www.gnu.org/software/src-highlite --&gt;
 &lt;pre&gt;&lt;tt&gt;ActionController&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Routing&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Routes&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;draw &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;map&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;
-  &lt;span style=&quot;color: #990000&quot;&gt;...&lt;/span&gt;
   map&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;yaffles
 &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;You can also see if your routes work by running &lt;tt&gt;rake routes&lt;/tt&gt; from your app directory.&lt;/p&gt;&lt;/div&gt;
 &lt;/div&gt;
-&lt;h2 id=&quot;_odds_and_ends&quot;&gt;10. Odds and ends&lt;/h2&gt;
+&lt;h2 id=&quot;_generators&quot;&gt;9. Generators&lt;/h2&gt;
 &lt;div class=&quot;sectionbody&quot;&gt;
-&lt;h3 id=&quot;_generate_rdoc_documentation&quot;&gt;10.1. Generate RDoc Documentation&lt;/h3&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Once your plugin is stable, the tests pass on all database and you are ready to deploy do everyone else a favor and document it!  Luckily, writing documentation for your plugin is easy.&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The first step is to update the README file with detailed information about how to use your plugin.  A few key things to include are:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Many plugins ship with generators.  When you created the plugin above, you specified the &amp;#8212;with-generator option, so you already have the generator stubs in &lt;em&gt;vendor/plugins/yaffle/generators/yaffle&lt;/em&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Building generators is a complex topic unto itself and this section will cover one small aspect of generators: generating a simple text file.&lt;/p&gt;&lt;/div&gt;
+&lt;h3 id=&quot;_testing_generators&quot;&gt;9.1. Testing generators&lt;/h3&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Many rails plugin authors do not test their generators, however testing generators is quite simple.  A typical generator test does the following:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;ilist&quot;&gt;&lt;ul&gt;
 &lt;li&gt;
 &lt;p&gt;
-Your name.
+Creates a new fake rails root directory that will serve as destination
 &lt;/p&gt;
 &lt;/li&gt;
 &lt;li&gt;
 &lt;p&gt;
-How to install.
+Runs the generator
 &lt;/p&gt;
 &lt;/li&gt;
 &lt;li&gt;
 &lt;p&gt;
-How to add the functionality to the app (several examples of common use cases).
+Asserts that the correct files were generated
 &lt;/p&gt;
 &lt;/li&gt;
 &lt;li&gt;
 &lt;p&gt;
-Warning, gotchas or tips that might help save users time.
+Removes the fake rails root
 &lt;/p&gt;
 &lt;/li&gt;
 &lt;/ul&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Once your README is solid, go through and add rdoc comments to all of the methods that developers will use.&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Before you generate your documentation, be sure to go through and add nodoc comments to those modules and methods that are not important to your users.&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Once your comments are good to go, navigate to your plugin directory and run:&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;literalblock&quot;&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;This section will describe how to create a simple generator that adds a file.  For the generator in this section, the test could look something like this:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/test/definition_generator_test.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;dirname&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;__FILE__&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'/test_helper.rb'&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'rails_generator'&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'rails_generator/scripts/generate'&lt;/span&gt;
+
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; DefinitionGeneratorTest &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; Test&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Unit&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;TestCase
+
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; setup
+    FileUtils&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;mkdir_p&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;fake_rails_root&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+    &lt;span style=&quot;color: #009900&quot;&gt;@original_files&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; file_list
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; teardown
+    FileUtils&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;rm_r&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;fake_rails_root&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; test_generates_correct_file_name
+    Rails&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Scripts&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generate&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;new&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;run&lt;span style=&quot;color: #990000&quot;&gt;([&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;yaffle_definition&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;],&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;destination &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; fake_rails_root&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+    new_file &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;file_list &lt;span style=&quot;color: #990000&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color: #009900&quot;&gt;@original_files&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;).&lt;/span&gt;first
+    assert_equal &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;definition.txt&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;basename&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;new_file&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+  private
+
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; fake_rails_root
+      File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;join&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;dirname&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;__FILE__&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;),&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'rails_root'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; file_list
+      Dir&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;glob&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;join&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;fake_rails_root&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;*&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;))&lt;/span&gt;
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;You can run &lt;em&gt;rake&lt;/em&gt; from the plugin directory to see this fail.  Unless you are doing more advanced generator commands it typically suffices to just test the Generate script, and trust that rails will handle the Destroy and Update commands for you.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;To make it pass, create the generator:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/generators/yaffle_definition/yaffle_definition_generator.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; YaffleDefinitionGenerator &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; Rails&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Base
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; manifest
+    record &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;m&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;
+      m&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;file &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;definition.txt&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;definition.txt&quot;&lt;/span&gt;
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;h3 id=&quot;_the_usage_file&quot;&gt;9.2. The USAGE file&lt;/h3&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;If you plan to distribute your plugin, developers will expect at least a minimum of documentation.  You can add simple documentation to the generator by updating the USAGE file.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Rails ships with several built-in generators.  You can see all of the generators available to you by typing the following at the command line:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;
-&lt;pre&gt;&lt;tt&gt;rake rdoc&lt;/tt&gt;&lt;/pre&gt;
+&lt;pre&gt;&lt;tt&gt;./script/generate&lt;/tt&gt;&lt;/pre&gt;
+&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;You should see something like this:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;
+&lt;pre&gt;&lt;tt&gt;Installed Generators
+  Plugins (vendor/plugins): yaffle_definition
+  Builtin: controller, integration_test, mailer, migration, model, observer, plugin, resource, scaffold, session_migration&lt;/tt&gt;&lt;/pre&gt;
 &lt;/div&gt;&lt;/div&gt;
-&lt;h3 id=&quot;_write_custom_rake_tasks_in_your_plugin&quot;&gt;10.2. Write custom Rake tasks in your plugin&lt;/h3&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;When you run &lt;tt&gt;script/generate yaffle_definition -h&lt;/tt&gt; you should see the contents of your &lt;em&gt;vendor/plugins/yaffle/generators/yaffle_definition/USAGE&lt;/em&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;For this plugin, update the USAGE file could look like this:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;
+&lt;pre&gt;&lt;tt&gt;Description:
+    Adds a file with the definition of a Yaffle to the app's main directory&lt;/tt&gt;&lt;/pre&gt;
+&lt;/div&gt;&lt;/div&gt;
+&lt;/div&gt;
+&lt;h2 id=&quot;_generator_commands&quot;&gt;10. Generator Commands&lt;/h2&gt;
+&lt;div class=&quot;sectionbody&quot;&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;You may have noticed above that you can used one of the built-in rails migration commands &lt;tt&gt;migration_template&lt;/tt&gt;.  If your plugin needs to add and remove lines of text from existing files you will need to write your own generator methods.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;This section describes how you you can create your own commands to add and remove a line of text from &lt;em&gt;config/routes.rb&lt;/em&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;To start, add the following test method:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/test/route_generator_test.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;dirname&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;__FILE__&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'/test_helper.rb'&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'rails_generator'&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'rails_generator/scripts/generate'&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'rails_generator/scripts/destroy'&lt;/span&gt;
+
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; RouteGeneratorTest &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; Test&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Unit&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;TestCase
+
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; setup
+    FileUtils&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;mkdir_p&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;join&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;fake_rails_root&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;config&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;))&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; teardown
+    FileUtils&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;rm_r&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;fake_rails_root&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; test_generates_route
+    content &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&amp;lt;-&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;END&lt;/span&gt;&lt;/span&gt;
+      ActionController&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Routing&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Routes&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;draw &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;map&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;
+        map&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;connect &lt;span style=&quot;color: #FF0000&quot;&gt;':controller/:action/:id'&lt;/span&gt;
+        map&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;connect &lt;span style=&quot;color: #FF0000&quot;&gt;':controller/:action/:id.:format'&lt;/span&gt;
+      &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;END&lt;/span&gt;&lt;/span&gt;
+    File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;open&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;routes_path&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'wb'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;f&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt; f&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;write&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;content&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;}&lt;/span&gt;
+
+    Rails&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Scripts&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generate&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;new&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;run&lt;span style=&quot;color: #990000&quot;&gt;([&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;yaffle_route&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;],&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;destination &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; fake_rails_root&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+    assert_match &lt;span style=&quot;color: #FF6600&quot;&gt;/map\.yaffles/&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;read&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;routes_path&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; test_destroys_route
+    content &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&amp;lt;-&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;END&lt;/span&gt;&lt;/span&gt;
+      ActionController&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Routing&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Routes&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;draw &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;map&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;
+        map&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;yaffles
+        map&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;connect &lt;span style=&quot;color: #FF0000&quot;&gt;':controller/:action/:id'&lt;/span&gt;
+        map&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;connect &lt;span style=&quot;color: #FF0000&quot;&gt;':controller/:action/:id.:format'&lt;/span&gt;
+      &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;END&lt;/span&gt;&lt;/span&gt;
+    File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;open&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;routes_path&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'wb'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;f&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt; f&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;write&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;content&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;}&lt;/span&gt;
+
+    Rails&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Scripts&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Destroy&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;new&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;run&lt;span style=&quot;color: #990000&quot;&gt;([&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;yaffle_route&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;],&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;destination &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; fake_rails_root&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+    assert_no_match &lt;span style=&quot;color: #FF6600&quot;&gt;/map\.yaffles/&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;read&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;routes_path&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+  private
+
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; fake_rails_root
+      File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;join&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;dirname&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;__FILE__&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;),&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;rails_root&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; routes_path
+      File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;join&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;fake_rails_root&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;config&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;routes.rb&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Run &lt;tt&gt;rake&lt;/tt&gt; to watch the test fail, then make the test pass add the following:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/lib/yaffle.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;yaffle/commands&quot;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/lib/yaffle/commands.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'rails_generator'&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'rails_generator/commands'&lt;/span&gt;
+
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;module&lt;/span&gt;&lt;/span&gt; Yaffle &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;#:nodoc:&lt;/span&gt;&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;module&lt;/span&gt;&lt;/span&gt; Generator &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;#:nodoc:&lt;/span&gt;&lt;/span&gt;
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;module&lt;/span&gt;&lt;/span&gt; Commands &lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;#:nodoc:&lt;/span&gt;&lt;/span&gt;
+      &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;module&lt;/span&gt;&lt;/span&gt; Create
+        &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; yaffle_route
+          logger&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;route &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;map.yaffle&quot;&lt;/span&gt;
+          look_for &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'ActionController::Routing::Routes.draw do |map|'&lt;/span&gt;
+          &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;unless&lt;/span&gt;&lt;/span&gt; options&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;pretend&lt;span style=&quot;color: #990000&quot;&gt;]&lt;/span&gt;
+            gsub_file&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;'config/routes.rb'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF6600&quot;&gt;/(#{Regexp.escape(look_for)})/&lt;/span&gt;mi&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;match&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;#{match}\n  map.yaffles\n&quot;&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;}&lt;/span&gt;
+          &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+        &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+      &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+      &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;module&lt;/span&gt;&lt;/span&gt; Destroy
+        &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; yaffle_route
+          logger&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;route &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;map.yaffle&quot;&lt;/span&gt;
+          gsub_file &lt;span style=&quot;color: #FF0000&quot;&gt;'config/routes.rb'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF6600&quot;&gt;/\n.+?map\.yaffles/&lt;/span&gt;mi&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;''&lt;/span&gt;
+        &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+      &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+      &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;module&lt;/span&gt;&lt;/span&gt; List
+        &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; yaffle_route
+        &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+      &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+      &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;module&lt;/span&gt;&lt;/span&gt; Update
+        &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; yaffle_route
+        &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+      &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+Rails&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Commands&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Create&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;send   &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;include&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;  Yaffle&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Commands&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Create
+Rails&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Commands&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Destroy&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;send  &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;include&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;  Yaffle&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Commands&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Destroy
+Rails&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Commands&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;List&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;send     &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;include&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;  Yaffle&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Commands&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;List
+Rails&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Commands&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Update&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;send   &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;include&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;  Yaffle&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Commands&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Update
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/generators/yaffle/yaffle_route_generator.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; YaffleRouteGenerator &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; Rails&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Base
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; manifest
+    record &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;m&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;
+      m&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;yaffle_route
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;To see this work, type:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;
+&lt;pre&gt;&lt;tt&gt;./script/generate yaffle_route
+./script/destroy yaffle_route&lt;/tt&gt;&lt;/pre&gt;
+&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;admonitionblock&quot;&gt;
+&lt;table&gt;&lt;tr&gt;
+&lt;td class=&quot;icon&quot;&gt;
+&lt;img src=&quot;./images/icons/note.png&quot; alt=&quot;Note&quot; /&gt;
+&lt;/td&gt;
+&lt;td class=&quot;content&quot;&gt;
+&lt;div class=&quot;title&quot;&gt;Editor's note:&lt;/div&gt;If you haven't set up the custom route from above, &lt;em&gt;script/destroy&lt;/em&gt; will fail and you'll have to remove it manually.&lt;/td&gt;
+&lt;/tr&gt;&lt;/table&gt;
+&lt;/div&gt;
+&lt;/div&gt;
+&lt;h2 id=&quot;_migrations&quot;&gt;11. Migrations&lt;/h2&gt;
+&lt;div class=&quot;sectionbody&quot;&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;If your plugin requires changes to the app's database you will likely want to somehow add migrations.  Rails does not include any built-in support for calling migrations from plugins, but you can still make it easy for developers to call migrations from plugins.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;If you have a very simple needs, like creating a table that will always have the same name and columns, then you can use a more simple solution, like creating a custom rake task or method.  If your migration needs user input to supply table names or other options, you probably want to opt for generating a migration.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Let's say you have the following migration in your plugin:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/lib/db/migrate/20081116181115_create_birdhouses.rb:&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; CreateBirdhouses &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Migration
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;self&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;up
+    create_table &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;birdhouses&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;force &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;true&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;t&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;
+      t&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;string &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;name
+      t&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;timestamps
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;self&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;down
+    drop_table &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;birdhouses
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Here are a few possibilities for how to allow developers to use your plugin migrations:&lt;/p&gt;&lt;/div&gt;
+&lt;h3 id=&quot;_create_a_custom_rake_task&quot;&gt;11.1. Create a custom rake task&lt;/h3&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/lib/db/migrate/20081116181115_create_birdhouses.rb:&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; CreateBirdhouses &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Migration
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;self&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;up
+    create_table &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;birdhouses&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;force &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;true&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;t&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;
+      t&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;string &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;name
+      t&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;timestamps
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;self&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;down
+    drop_table &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;birdhouses
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/tasks/yaffle.rake:&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;namespace &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;db &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt;
+  namespace &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;migrate &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt;
+    desc &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;Migrate the database through scripts in vendor/plugins/yaffle/lib/db/migrate and update db/schema.rb by invoking db:schema:dump. Target specific version with VERSION=x. Turn off output with VERBOSE=false.&quot;&lt;/span&gt;
+    task &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;yaffle &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;environment &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt;
+      ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Migration&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;verbose &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; ENV&lt;span style=&quot;color: #990000&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;VERBOSE&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;?&lt;/span&gt; ENV&lt;span style=&quot;color: #990000&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;VERBOSE&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;true&quot;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;true&lt;/span&gt;&lt;/span&gt;
+      ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Migrator&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;migrate&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;vendor/plugins/yaffle/lib/db/migrate/&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; ENV&lt;span style=&quot;color: #990000&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;VERSION&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;?&lt;/span&gt; ENV&lt;span style=&quot;color: #990000&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;VERSION&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;].&lt;/span&gt;to_i &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;nil&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+      Rake&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Task&lt;span style=&quot;color: #990000&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;db:schema:dump&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;].&lt;/span&gt;invoke &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;if&lt;/span&gt;&lt;/span&gt; ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Base&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;schema_format &lt;span style=&quot;color: #990000&quot;&gt;==&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;ruby
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;h3 id=&quot;_call_migrations_directly&quot;&gt;11.2. Call migrations directly&lt;/h3&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/lib/yaffle.rb:&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;Dir&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;glob&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;join&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;dirname&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;__FILE__&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;),&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;db&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;migrate&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;*&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)).&lt;/span&gt;each &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;file&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; file
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;db/migrate/20081116181115_create_birdhouses.rb:&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; CreateBirdhouses &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Migration
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;self&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;up
+    Yaffle&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;CreateBirdhouses&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;up
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;self&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;down
+    Yaffle&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;CreateBirdhouses&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;down
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;admonitionblock&quot;&gt;
+&lt;table&gt;&lt;tr&gt;
+&lt;td class=&quot;icon&quot;&gt;
+&lt;img src=&quot;./images/icons/note.png&quot; alt=&quot;Note&quot; /&gt;
+&lt;/td&gt;
+&lt;td class=&quot;content&quot;&gt;
+&lt;div class=&quot;title&quot;&gt;Editor's note:&lt;/div&gt;several plugin frameworks such as Desert and Engines provide more advanced plugin functionality.&lt;/td&gt;
+&lt;/tr&gt;&lt;/table&gt;
+&lt;/div&gt;
+&lt;h3 id=&quot;_generate_migrations&quot;&gt;11.3. Generate migrations&lt;/h3&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Generating migrations has several advantages over other methods.  Namely, you can allow other developers to more easily customize the migration.  The flow looks like this:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;ilist&quot;&gt;&lt;ul&gt;
+&lt;li&gt;
+&lt;p&gt;
+call your script/generate script and pass in whatever options they need
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+examine the generated migration, adding/removing columns or other options as necessary
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;/ul&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;This example will demonstrate how to use one of the built-in generator methods named &lt;em&gt;migration_template&lt;/em&gt; to create a migration file.  Extending the rails migration generator requires a somewhat intimate knowledge of the migration generator internals, so it's best to write a test first:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/test/yaffle_migration_generator_test.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;dirname&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;__FILE__&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'/test_helper.rb'&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'rails_generator'&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'rails_generator/scripts/generate'&lt;/span&gt;
+
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; MigrationGeneratorTest &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; Test&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Unit&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;TestCase
+
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; setup
+    FileUtils&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;mkdir_p&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;fake_rails_root&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+    &lt;span style=&quot;color: #009900&quot;&gt;@original_files&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; file_list
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; teardown
+    ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Base&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;pluralize_table_names &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;true&lt;/span&gt;&lt;/span&gt;
+    FileUtils&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;rm_r&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;fake_rails_root&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; test_generates_correct_file_name
+    Rails&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Scripts&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generate&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;new&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;run&lt;span style=&quot;color: #990000&quot;&gt;([&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;yaffle_migration&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;some_name_nobody_is_likely_to_ever_use_in_a_real_migration&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;],&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;destination &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; fake_rails_root&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+    new_file &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;file_list &lt;span style=&quot;color: #990000&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color: #009900&quot;&gt;@original_files&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;).&lt;/span&gt;first
+    assert_match &lt;span style=&quot;color: #FF6600&quot;&gt;/add_yaffle_fields_to_some_name_nobody_is_likely_to_ever_use_in_a_real_migrations/&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; new_file
+    assert_match &lt;span style=&quot;color: #FF6600&quot;&gt;/add_column :some_name_nobody_is_likely_to_ever_use_in_a_real_migrations do |t|/&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;read&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;new_file&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; test_pluralizes_properly
+    ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Base&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;pluralize_table_names &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;false&lt;/span&gt;&lt;/span&gt;
+    Rails&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Scripts&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generate&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;new&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;run&lt;span style=&quot;color: #990000&quot;&gt;([&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;yaffle_migration&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;some_name_nobody_is_likely_to_ever_use_in_a_real_migration&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;],&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;destination &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; fake_rails_root&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+    new_file &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;file_list &lt;span style=&quot;color: #990000&quot;&gt;-&lt;/span&gt; &lt;span style=&quot;color: #009900&quot;&gt;@original_files&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;).&lt;/span&gt;first
+    assert_match &lt;span style=&quot;color: #FF6600&quot;&gt;/add_yaffle_fields_to_some_name_nobody_is_likely_to_ever_use_in_a_real_migration/&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; new_file
+    assert_match &lt;span style=&quot;color: #FF6600&quot;&gt;/add_column :some_name_nobody_is_likely_to_ever_use_in_a_real_migration do |t|/&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;read&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;new_file&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+  private
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; fake_rails_root
+      File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;join&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;dirname&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;__FILE__&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;),&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'rails_root'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; file_list
+      Dir&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;glob&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;join&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;fake_rails_root&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;db&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;migrate&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;*&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;))&lt;/span&gt;
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;admonitionblock&quot;&gt;
+&lt;table&gt;&lt;tr&gt;
+&lt;td class=&quot;icon&quot;&gt;
+&lt;img src=&quot;./images/icons/note.png&quot; alt=&quot;Note&quot; /&gt;
+&lt;/td&gt;
+&lt;td class=&quot;content&quot;&gt;
+&lt;div class=&quot;title&quot;&gt;Editor's note:&lt;/div&gt;the migration generator checks to see if a migation already exists, and it's hard-coded to check the &lt;em&gt;db/migrate&lt;/em&gt; directory.  As a result, if your test tries to generate a migration that already exists in the app, it will fail.  The easy workaround is to make sure that the name you generate in your test is very unlikely to actually appear in the app.&lt;/td&gt;
+&lt;/tr&gt;&lt;/table&gt;
+&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;After running the test with &lt;em&gt;rake&lt;/em&gt; you can make it pass with:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/generators/yaffle/yaffle_generator.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; YaffleMigrationGenerator &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; Rails&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;NamedBase
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; manifest
+    record &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;m&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;
+      m&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;migration_template &lt;span style=&quot;color: #FF0000&quot;&gt;'migration:migration.rb'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;db/migrate&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;{&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;assigns &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; yaffle_local_assigns&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;
+        &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;migration_file_name &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;add_yaffle_fields_to_#{custom_file_name}&quot;&lt;/span&gt;
+      &lt;span style=&quot;color: #FF0000&quot;&gt;}&lt;/span&gt;
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+  private
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; custom_file_name
+      custom_name &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; class_name&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;underscore&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;downcase
+      custom_name &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; custom_name&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;pluralize &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;if&lt;/span&gt;&lt;/span&gt; ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Base&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;pluralize_table_names
+      custom_name
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; yaffle_local_assigns
+      returning&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;assigns &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;{}&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt;
+        assigns&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;migration_action&lt;span style=&quot;color: #990000&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;add&quot;&lt;/span&gt;
+        assigns&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;class_name&lt;span style=&quot;color: #990000&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;add_yaffle_fields_to_#{custom_file_name}&quot;&lt;/span&gt;
+        assigns&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;table_name&lt;span style=&quot;color: #990000&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; custom_file_name
+        assigns&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;attributes&lt;span style=&quot;color: #990000&quot;&gt;]&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;[&lt;/span&gt;Rails&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Generator&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;GeneratedAttribute&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;new&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;last_squawk&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;string&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)]&lt;/span&gt;
+      &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+    &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The generator creates a new file in &lt;em&gt;db/migrate&lt;/em&gt; with a timestamp and an &lt;em&gt;add_column&lt;/em&gt; statement.  It reuses the built in rails &lt;tt&gt;migration_template&lt;/tt&gt; method, and reuses the built-in rails migration template.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;It's courteous to check to see if table names are being pluralized whenever you create a generator that needs to be aware of table names.  This way people using your generator won't have to manually change the generated files if they've turned pluralization off.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;To run the generator, type the following at the command line:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;
+&lt;pre&gt;&lt;tt&gt;./script/generate yaffle_migration bird&lt;/tt&gt;&lt;/pre&gt;
+&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;and you will see a new file:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;db/migrate/20080529225649_add_yaffle_fields_to_birds.rb&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;class&lt;/span&gt;&lt;/span&gt; AddYaffleFieldsToBirds &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&lt;/span&gt; ActiveRecord&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Migration
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;self&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;up
+    add_column &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;birds&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;last_squawk&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;string
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;self&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;down
+    remove_column &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;birds&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;last_squawk
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;/div&gt;
+&lt;h2 id=&quot;_rake_tasks&quot;&gt;12. Rake tasks&lt;/h2&gt;
+&lt;div class=&quot;sectionbody&quot;&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;When you created the plugin with the built-in rails generator, it generated a rake file for you in &lt;em&gt;vendor/plugins/yaffle/tasks/yaffle.rake&lt;/em&gt;.  Any rake task you add here will be available to the app.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;Many plugin authors put all of their rake tasks into a common namespace that is the same as the plugin, like so:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/tasks/yaffle.rake&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
@@ -1510,25 +1697,93 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;pre&gt;&lt;tt&gt;yaffle:squawk             # Prints out the word 'Yaffle'&lt;/tt&gt;&lt;/pre&gt;
 &lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;You can add as many files as you want in the tasks directory, and if they end in .rake Rails will pick them up.&lt;/p&gt;&lt;/div&gt;
-&lt;h3 id=&quot;_store_plugins_in_alternate_locations&quot;&gt;10.3. Store plugins in alternate locations&lt;/h3&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;You can store plugins wherever you want - you just have to add those plugins to the plugins path in &lt;em&gt;environment.rb&lt;/em&gt;.&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Since the plugin is only loaded after the plugin paths are defined, you can't redefine this in your plugins - but it may be good to now.&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;You can even store plugins inside of other plugins for complete plugin madness!&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Note that tasks from &lt;em&gt;vendor/plugins/yaffle/Rakefile&lt;/em&gt; are not available to the main app.&lt;/p&gt;&lt;/div&gt;
+&lt;/div&gt;
+&lt;h2 id=&quot;_plugingems&quot;&gt;13. PluginGems&lt;/h2&gt;
+&lt;div class=&quot;sectionbody&quot;&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Turning your rails plugin into a gem is a simple and straightforward task.  This section will cover how to turn your plugin into a gem.  It will not cover how to distribute that gem.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Historically rails plugins loaded the plugin's &lt;em&gt;init.rb&lt;/em&gt; file.  In fact some plugins contain all of their code in that one file.  To be compatible with plugins, &lt;em&gt;init.rb&lt;/em&gt; was moved to &lt;em&gt;rails/init.rb&lt;/em&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;It's common practice to put any developer-centric rake tasks (such as tests, rdoc and gem package tasks) in &lt;em&gt;Rakefile&lt;/em&gt;.  A rake task that packages the gem might look like this:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/Rakefile:&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
 by Lorenzo Bettini
 http://www.lorenzobettini.it
 http://www.gnu.org/software/src-highlite --&gt;
-&lt;pre&gt;&lt;tt&gt;config&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;plugin_paths &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;join&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;RAILS_ROOT&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;vendor&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;plugins&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;yaffle&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;lib&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;plugins&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+&lt;pre&gt;&lt;tt&gt;PKG_FILES &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; FileList&lt;span style=&quot;color: #990000&quot;&gt;[&lt;/span&gt;
+  &lt;span style=&quot;color: #FF0000&quot;&gt;'[a-zA-Z]*'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;
+  &lt;span style=&quot;color: #FF0000&quot;&gt;'generators/**/*'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;
+  &lt;span style=&quot;color: #FF0000&quot;&gt;'lib/**/*'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;
+  &lt;span style=&quot;color: #FF0000&quot;&gt;'rails/**/*'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;
+  &lt;span style=&quot;color: #FF0000&quot;&gt;'tasks/**/*'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;
+  &lt;span style=&quot;color: #FF0000&quot;&gt;'test/**/*'&lt;/span&gt;
+&lt;span style=&quot;color: #990000&quot;&gt;]&lt;/span&gt;
+
+spec &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; Gem&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Specification&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;new &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;s&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;
+  s&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;name &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;yaffle&quot;&lt;/span&gt;
+  s&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;version &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;0.0.1&quot;&lt;/span&gt;
+  s&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;author &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;Gleeful Yaffler&quot;&lt;/span&gt;
+  s&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;email &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;yaffle@example.com&quot;&lt;/span&gt;
+  s&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;homepage &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;http://yafflers.example.com/&quot;&lt;/span&gt;
+  s&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;platform &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; Gem&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Platform&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;RUBY
+  s&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;summary &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;Sharing Yaffle Goodness&quot;&lt;/span&gt;
+  s&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;files &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; PKG_FILES&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;to_a
+  s&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;require_path &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;lib&quot;&lt;/span&gt;
+  s&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;has_rdoc &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;false&lt;/span&gt;&lt;/span&gt;
+  s&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;extra_rdoc_files &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;README&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;]&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+desc &lt;span style=&quot;color: #FF0000&quot;&gt;'Turn this plugin into a gem.'&lt;/span&gt;
+Rake&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;GemPackageTask&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;new&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;spec&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;pkg&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;
+  pkg&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;gem_spec &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; spec
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
-&lt;h3 id=&quot;_create_your_own_plugin_loaders_and_plugin_locators&quot;&gt;10.4. Create your own Plugin Loaders and Plugin Locators&lt;/h3&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;If the built-in plugin behavior is inadequate, you can change almost every aspect of the location and loading process.  You can write your own plugin locators and plugin loaders, but that's beyond the scope of this tutorial.&lt;/p&gt;&lt;/div&gt;
-&lt;h3 id=&quot;_use_custom_plugin_generators&quot;&gt;10.5. Use Custom Plugin Generators&lt;/h3&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;If you are an RSpec fan, you can install the &lt;tt&gt;rspec_plugin_generator&lt;/tt&gt; gem, which will generate the spec folder and database for you. See &lt;a href=&quot;http://github.com/pat-maddox/rspec-plugin-generator/tree/master&quot;&gt;http://github.com/pat-maddox/rspec-plugin-generator/tree/master&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;To build and install the gem locally, run the following commands:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;
+&lt;pre&gt;&lt;tt&gt;cd vendor/plugins/yaffle
+rake gem
+sudo gem install pkg/yaffle-0.0.1.gem&lt;/tt&gt;&lt;/pre&gt;
+&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;To test this, create a new rails app, add &lt;em&gt;config.gem &quot;yaffle&quot;&lt;/em&gt; to environment.rb and all of your plugin's functionality will be available to you.&lt;/p&gt;&lt;/div&gt;
 &lt;/div&gt;
-&lt;h2 id=&quot;_appendix&quot;&gt;11. Appendix&lt;/h2&gt;
+&lt;h2 id=&quot;_rdoc_documentation&quot;&gt;14. RDoc Documentation&lt;/h2&gt;
 &lt;div class=&quot;sectionbody&quot;&gt;
-&lt;h3 id=&quot;_references&quot;&gt;11.1. References&lt;/h3&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Once your plugin is stable and you are ready to deploy do everyone else a favor and document it!  Luckily, writing documentation for your plugin is easy.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The first step is to update the README file with detailed information about how to use your plugin.  A few key things to include are:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;ilist&quot;&gt;&lt;ul&gt;
+&lt;li&gt;
+&lt;p&gt;
+Your name
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+How to install
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+How to add the functionality to the app (several examples of common use cases)
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+Warning, gotchas or tips that might help save users time
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;/ul&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Once your README is solid, go through and add rdoc comments to all of the methods that developers will use.  It's also customary to add &lt;em&gt;#:nodoc:&lt;/em&gt; comments to those parts of the code that are not part of the public api.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Once your comments are good to go, navigate to your plugin directory and run:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;
+&lt;pre&gt;&lt;tt&gt;rake rdoc&lt;/tt&gt;&lt;/pre&gt;
+&lt;/div&gt;&lt;/div&gt;
+&lt;/div&gt;
+&lt;h2 id=&quot;_appendix&quot;&gt;15. Appendix&lt;/h2&gt;
+&lt;div class=&quot;sectionbody&quot;&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;If you prefer to use RSpec instead of Test::Unit, you may be interested in the &lt;a href=&quot;http://github.com/pat-maddox/rspec-plugin-generator/tree/master&quot;&gt;RSpec Plugin Generator&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;h3 id=&quot;_references&quot;&gt;15.1. References&lt;/h3&gt;
 &lt;div class=&quot;ilist&quot;&gt;&lt;ul&gt;
 &lt;li&gt;
 &lt;p&gt;
@@ -1550,41 +1805,104 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;a href=&quot;http://daddy.platte.name/2007/05/rails-plugins-keep-initrb-thin.html&quot;&gt;http://daddy.platte.name/2007/05/rails-plugins-keep-initrb-thin.html&lt;/a&gt;
 &lt;/p&gt;
 &lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;a href=&quot;http://www.mbleigh.com/2008/6/11/gemplugins-a-brief-introduction-to-the-future-of-rails-plugins&quot;&gt;http://www.mbleigh.com/2008/6/11/gemplugins-a-brief-introduction-to-the-future-of-rails-plugins&lt;/a&gt;
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+&lt;a href=&quot;http://weblog.jamisbuck.org/2006/10/26/monkey-patching-rails-extending-routes-2&quot;&gt;http://weblog.jamisbuck.org/2006/10/26/monkey-patching-rails-extending-routes-2&lt;/a&gt;.
+&lt;/p&gt;
+&lt;/li&gt;
 &lt;/ul&gt;&lt;/div&gt;
-&lt;h3 id=&quot;_final_plugin_directory_structure&quot;&gt;11.2. Final plugin directory structure&lt;/h3&gt;
+&lt;h3 id=&quot;_contents_of_em_lib_yaffle_rb_em&quot;&gt;15.2. Contents of &lt;em&gt;lib/yaffle.rb&lt;/em&gt;&lt;/h3&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;strong&gt;vendor/plugins/yaffle/lib/yaffle.rb:&lt;/strong&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;yaffle/core_ext&quot;&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;yaffle/acts_as_yaffle&quot;&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;yaffle/commands&quot;&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #000080&quot;&gt;require&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;yaffle/routing&quot;&lt;/span&gt;
+
+&lt;span style=&quot;color: #990000&quot;&gt;%&lt;/span&gt;w&lt;span style=&quot;color: #FF0000&quot;&gt;{&lt;/span&gt; models controllers helpers &lt;span style=&quot;color: #FF0000&quot;&gt;}&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;each &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;do&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;dir&lt;span style=&quot;color: #990000&quot;&gt;|&lt;/span&gt;
+  path &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;join&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;File&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;dirname&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;__FILE__&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;),&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'app'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; dir&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+  &lt;span style=&quot;color: #009900&quot;&gt;$LOAD_PATH&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; path
+  ActiveSupport&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Dependencies&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;load_paths &lt;span style=&quot;color: #990000&quot;&gt;&amp;lt;&amp;lt;&lt;/span&gt; path
+  ActiveSupport&lt;span style=&quot;color: #990000&quot;&gt;::&lt;/span&gt;Dependencies&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;load_once_paths&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;delete&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;path&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
+
+&lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# optionally:&lt;/span&gt;&lt;/span&gt;
+&lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# Dir.glob(File.join(File.dirname(__FILE__), &quot;db&quot;, &quot;migrate&quot;, &quot;*&quot;)).each do |file|&lt;/span&gt;&lt;/span&gt;
+&lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;#   require file&lt;/span&gt;&lt;/span&gt;
+&lt;span style=&quot;font-style: italic&quot;&gt;&lt;span style=&quot;color: #9A1900&quot;&gt;# end&lt;/span&gt;&lt;/span&gt;
+
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;h3 id=&quot;_final_plugin_directory_structure&quot;&gt;15.3. Final plugin directory structure&lt;/h3&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;The final plugin should have a directory structure that looks something like this:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;
-&lt;pre&gt;&lt;tt&gt;  |-- MIT-LICENSE
-  |-- README
-  |-- Rakefile
-  |-- generators
-  |   `-- yaffle
-  |       |-- USAGE
-  |       |-- templates
-  |       |   `-- definition.txt
-  |       `-- yaffle_generator.rb
-  |-- init.rb
-  |-- install.rb
-  |-- lib
-  |   |-- acts_as_yaffle.rb
-  |   |-- commands.rb
-  |   |-- core_ext.rb
-  |   |-- routing.rb
-  |   `-- view_helpers.rb
-  |-- tasks
-  |   `-- yaffle_tasks.rake
-  |-- test
-  |   |-- acts_as_yaffle_test.rb
-  |   |-- core_ext_test.rb
-  |   |-- database.yml
-  |   |-- debug.log
-  |   |-- routing_test.rb
-  |   |-- schema.rb
-  |   |-- test_helper.rb
-  |   `-- view_helpers_test.rb
-  |-- uninstall.rb
-  `-- yaffle_plugin.sqlite3.db&lt;/tt&gt;&lt;/pre&gt;
+&lt;pre&gt;&lt;tt&gt;|-- MIT-LICENSE
+|-- README
+|-- Rakefile
+|-- generators
+|   |-- yaffle_definition
+|   |   |-- USAGE
+|   |   |-- templates
+|   |   |   `-- definition.txt
+|   |   `-- yaffle_definition_generator.rb
+|   |-- yaffle_migration
+|   |   |-- USAGE
+|   |   |-- templates
+|   |   `-- yaffle_migration_generator.rb
+|   `-- yaffle_route
+|       |-- USAGE
+|       |-- templates
+|       `-- yaffle_route_generator.rb
+|-- install.rb
+|-- lib
+|   |-- app
+|   |   |-- controllers
+|   |   |   `-- woodpeckers_controller.rb
+|   |   |-- helpers
+|   |   |   `-- woodpeckers_helper.rb
+|   |   `-- models
+|   |       `-- woodpecker.rb
+|   |-- db
+|   |   `-- migrate
+|   |       `-- 20081116181115_create_birdhouses.rb
+|   |-- yaffle
+|   |   |-- acts_as_yaffle.rb
+|   |   |-- commands.rb
+|   |   |-- core_ext.rb
+|   |   `-- routing.rb
+|   `-- yaffle.rb
+|-- pkg
+|   `-- yaffle-0.0.1.gem
+|-- rails
+|   `-- init.rb
+|-- tasks
+|   `-- yaffle_tasks.rake
+|-- test
+|   |-- acts_as_yaffle_test.rb
+|   |-- core_ext_test.rb
+|   |-- database.yml
+|   |-- debug.log
+|   |-- definition_generator_test.rb
+|   |-- migration_generator_test.rb
+|   |-- route_generator_test.rb
+|   |-- routes_test.rb
+|   |-- schema.rb
+|   |-- test_helper.rb
+|   |-- woodpecker_test.rb
+|   |-- woodpeckers_controller_test.rb
+|   |-- wookpeckers_helper_test.rb
+|   |-- yaffle_plugin.sqlite3.db
+|   `-- yaffle_test.rb
+`-- uninstall.rb&lt;/tt&gt;&lt;/pre&gt;
 &lt;/div&gt;&lt;/div&gt;
 &lt;/div&gt;
 </diff>
      <filename>railties/doc/guides/html/creating_plugins.html</filename>
    </modified>
    <modified>
      <diff>@@ -215,7 +215,7 @@ ul#navMain {
 						
 							&lt;li&gt;&lt;a href=&quot;#_array_conditions&quot;&gt;Array Conditions&lt;/a&gt;&lt;/li&gt;
 						
-							&lt;li&gt;&lt;a href=&quot;#_hash_conditions&quot;&gt;Hash Conditions&lt;/a&gt;&lt;/li&gt;
+							&lt;li&gt;&lt;a href=&quot;#_placeholder_conditions&quot;&gt;Placeholder Conditions&lt;/a&gt;&lt;/li&gt;
 						
 						&lt;/ul&gt;
 					&lt;/li&gt;
@@ -344,6 +344,7 @@ Perform aggregate calculations on Active Record models
 &lt;/li&gt;
 &lt;/ul&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;If you're used to using raw SQL to find database records, you'll find that there are generally better ways to carry out the same operations in Rails. Active Record insulates you from the need to use SQL in most cases.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;The SQL in your log may have some quoting, and that quoting depends on the backend (MySQL, for example, puts backticks around field and table names). Attempting to copy the raw SQL contained within this guide may not work in your database system. Please consult the database systems manual before attempting to execute any SQL.&lt;/p&gt;&lt;/div&gt;
 &lt;/div&gt;
 &lt;/div&gt;
 &lt;h2 id=&quot;_the_sample_models&quot;&gt;1. The Sample Models&lt;/h2&gt;
@@ -389,14 +390,14 @@ http://www.gnu.org/software/src-highlite --&gt;
 by Lorenzo Bettini
 http://www.lorenzobettini.it
 http://www.gnu.org/software/src-highlite --&gt;
-&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;FROM&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt;clients&lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;WHERE&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;(+&lt;/span&gt;clients&lt;span style=&quot;color: #990000&quot;&gt;+.+&lt;/span&gt;id&lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #993399&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;FROM&lt;/span&gt;&lt;/span&gt; clients &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;WHERE&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;clients&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;id &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #993399&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;admonitionblock&quot;&gt;
 &lt;table&gt;&lt;tr&gt;
 &lt;td class=&quot;icon&quot;&gt;
 &lt;img src=&quot;./images/icons/note.png&quot; alt=&quot;Note&quot; /&gt;
 &lt;/td&gt;
-&lt;td class=&quot;content&quot;&gt;Because this is a standard table created from a migration in Rail, the primary key is defaulted to &lt;em&gt;id&lt;/em&gt;. If you have specified a different primary key in your migrations, this is what Rails will find on when you call the find method, not the id column.&lt;/td&gt;
+&lt;td class=&quot;content&quot;&gt;Because this is a standard table created from a migration in Rails, the primary key is defaulted to &lt;em&gt;id&lt;/em&gt;. If you have specified a different primary key in your migrations, this is what Rails will find on when you call the find method, not the id column.&lt;/td&gt;
 &lt;/tr&gt;&lt;/table&gt;
 &lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;If you wanted to find clients with id 1 or 2, you call &lt;tt&gt;Client.find([1,2])&lt;/tt&gt; or &lt;tt&gt;Client.find(1,2)&lt;/tt&gt; and then this will be executed as:&lt;/p&gt;&lt;/div&gt;
@@ -405,7 +406,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 by Lorenzo Bettini
 http://www.lorenzobettini.it
 http://www.gnu.org/software/src-highlite --&gt;
-&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;FROM&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt;clients&lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;WHERE&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;(+&lt;/span&gt;clients&lt;span style=&quot;color: #990000&quot;&gt;+.+&lt;/span&gt;id&lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;IN&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #993399&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #993399&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;))&lt;/span&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;FROM&lt;/span&gt;&lt;/span&gt; clients &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;WHERE&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;clients&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;id &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;IN&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #993399&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #993399&quot;&gt;2&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;))&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;
@@ -424,14 +425,14 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;td class=&quot;content&quot;&gt;If &lt;tt&gt;find(id)&lt;/tt&gt; or &lt;tt&gt;find([id1, id2])&lt;/tt&gt; fails to find any records, it will raise a &lt;tt&gt;RecordNotFound&lt;/tt&gt; exception.&lt;/td&gt;
 &lt;/tr&gt;&lt;/table&gt;
 &lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;If you wanted to find the first client you would simply type &lt;tt&gt;Client.first&lt;/tt&gt; and that would find the first client created in your clients table:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;If you wanted to find the first Client object you would simply type &lt;tt&gt;Client.first&lt;/tt&gt; and that would find the first client in your clients table:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;
 &lt;pre&gt;&lt;tt&gt;&amp;gt;&amp;gt; Client.first
 =&amp;gt; #&amp;lt;Client id: 1, name: =&amp;gt; &quot;Ryan&quot;, locked: false, orders_count: 2,
   created_at: &quot;2008-09-28 15:38:50&quot;, updated_at: &quot;2008-09-28 15:38:50&quot;&amp;gt;&lt;/tt&gt;&lt;/pre&gt;
 &lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;If you were running script/server you might see the following output:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;If you were reading your log file (the default is log/development.log) you may see something like this:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
 by Lorenzo Bettini
@@ -440,13 +441,29 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;FROM&lt;/span&gt;&lt;/span&gt; clients &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;LIMIT&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #993399&quot;&gt;1&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;Indicating the query that Rails has performed on your database.&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;To find the last client you would simply type &lt;tt&gt;Client.find(:last)&lt;/tt&gt; and that would find the last client created in your clients table:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;To find the last Client object you would simply type &lt;tt&gt;Client.last&lt;/tt&gt; and that would find the last client created in your clients table:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;
-&lt;pre&gt;&lt;tt&gt;&amp;gt;&amp;gt; Client.find(:last)
+&lt;pre&gt;&lt;tt&gt;&amp;gt;&amp;gt; Client.last
 =&amp;gt; #&amp;lt;Client id: 2, name: =&amp;gt; &quot;Michael&quot;, locked: false, orders_count: 3,
   created_at: &quot;2008-09-28 13:12:40&quot;, updated_at: &quot;2008-09-28 13:12:40&quot;&amp;gt;&lt;/tt&gt;&lt;/pre&gt;
 &lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;If you were reading your log file (the default is log/development.log) you may see something like this:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;FROM&lt;/span&gt;&lt;/span&gt; clients &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;ORDER&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;BY&lt;/span&gt;&lt;/span&gt; id &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;DESC&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;LIMIT&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #993399&quot;&gt;1&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;admonitionblock&quot;&gt;
+&lt;table&gt;&lt;tr&gt;
+&lt;td class=&quot;icon&quot;&gt;
+&lt;img src=&quot;./images/icons/note.png&quot; alt=&quot;Note&quot; /&gt;
+&lt;/td&gt;
+&lt;td class=&quot;content&quot;&gt;Please be aware that the syntax that Rails uses to find the first record in the table means that it may not be the actual first record. If you want the actual first record based on a field in your table (e.g. &lt;tt&gt;created_at&lt;/tt&gt;) specify an order option in your find call. The last method call works differently: it finds the last record on your table based on the primary key column.&lt;/td&gt;
+&lt;/tr&gt;&lt;/table&gt;
+&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
 by Lorenzo Bettini
@@ -454,7 +471,7 @@ http://www.lorenzobettini.it
 http://www.gnu.org/software/src-highlite --&gt;
 &lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;FROM&lt;/span&gt;&lt;/span&gt; clients &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;ORDER&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;BY&lt;/span&gt;&lt;/span&gt; clients&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;id &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;DESC&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;LIMIT&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #993399&quot;&gt;1&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;To find all the clients you would simply type &lt;tt&gt;Client.all&lt;/tt&gt; and that would find all the clients in your clients table:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;To find all the Client objects you would simply type &lt;tt&gt;Client.all&lt;/tt&gt; and that would find all the clients in your clients table:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;
 &lt;pre&gt;&lt;tt&gt;&amp;gt;&amp;gt; Client.all
@@ -463,8 +480,8 @@ http://www.gnu.org/software/src-highlite --&gt;
   #&amp;lt;Client id: 2, name: =&amp;gt; &quot;Michael&quot;, locked: false, orders_count: 3,
   created_at: &quot;2008-09-28 13:12:40&quot;, updated_at: &quot;2008-09-28 13:12:40&quot;&amp;gt;]&lt;/tt&gt;&lt;/pre&gt;
 &lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;As alternatives to calling &lt;tt&gt;Client.first&lt;/tt&gt;, &lt;tt&gt;Client.last&lt;/tt&gt;, and &lt;tt&gt;Client.all&lt;/tt&gt;, you can use the class methods &lt;tt&gt;Client.first&lt;/tt&gt;, &lt;tt&gt;Client.last&lt;/tt&gt;, and &lt;tt&gt;Client.all&lt;/tt&gt; instead. &lt;tt&gt;Client.first&lt;/tt&gt;, &lt;tt&gt;Client.last&lt;/tt&gt; and &lt;tt&gt;Client.all&lt;/tt&gt; just call their longer counterparts: &lt;tt&gt;Client.find(:first)&lt;/tt&gt;, &lt;tt&gt;Client.find(:last)&lt;/tt&gt; and &lt;tt&gt;Client.find(:all)&lt;/tt&gt; respectively.&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Be aware that &lt;tt&gt;Client.first&lt;/tt&gt;/&lt;tt&gt;Client.find(:first)&lt;/tt&gt; and &lt;tt&gt;Client.last&lt;/tt&gt;/&lt;tt&gt;Client.find(:last)&lt;/tt&gt; will both return a single object, where as &lt;tt&gt;Client.all&lt;/tt&gt;/&lt;tt&gt;Client.find(:all)&lt;/tt&gt; will return an array of Client objects, just as passing in an array of ids to find will do also.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;You may see in Rails code that there are calls to methods such as &lt;tt&gt;Client.find(:all)&lt;/tt&gt;, &lt;tt&gt;Client.find(:first)&lt;/tt&gt; and &lt;tt&gt;Client.find(:last)&lt;/tt&gt;. These methods are just alternatives to &lt;tt&gt;Client.all&lt;/tt&gt;, &lt;tt&gt;Client.first&lt;/tt&gt; and &lt;tt&gt;Client.last&lt;/tt&gt; respectively.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Be aware that &lt;tt&gt;Client.first&lt;/tt&gt;/&lt;tt&gt;Client.find(:first)&lt;/tt&gt; and &lt;tt&gt;Client.last&lt;/tt&gt;/&lt;tt&gt;Client.find(:last)&lt;/tt&gt; will both return a single object, where as &lt;tt&gt;Client.all&lt;/tt&gt;/&lt;tt&gt;Client.find(:all)&lt;/tt&gt; will return an array of Client objects, just as passing in an array of ids to &lt;tt&gt;find&lt;/tt&gt; will do also.&lt;/p&gt;&lt;/div&gt;
 &lt;/div&gt;
 &lt;h2 id=&quot;_conditions&quot;&gt;4. Conditions&lt;/h2&gt;
 &lt;div class=&quot;sectionbody&quot;&gt;
@@ -480,20 +497,23 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;/tr&gt;&lt;/table&gt;
 &lt;/div&gt;
 &lt;h3 id=&quot;_array_conditions&quot;&gt;4.2. Array Conditions&lt;/h3&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Now what if that number could vary, say as a parameter from somewhere, or perhaps from the user's level status somewhere? The find then becomes something like &lt;tt&gt;Client.first(:conditions &amp;#8658; [&quot;orders_count = ?&quot;, params[:orders]])&lt;/tt&gt;. Active Record will go through the first element in the conditions value and any additional elements will replace the question marks (?) in the first element. If you want to specify two conditions, you can do it like &lt;tt&gt;Client.first(:conditions &amp;#8658; [&quot;orders_count = ? AND locked = ?&quot;, params[:orders], false])&lt;/tt&gt;. In this example, the first question mark will be replaced with the value in params orders and the second will be replaced with true and this will find the first record in the table that has &lt;em&gt;2&lt;/em&gt; as its value for the orders_count field and &lt;em&gt;false&lt;/em&gt; for its locked field.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Now what if that number could vary, say as a parameter from somewhere, or perhaps from the user's level status somewhere? The find then becomes something like &lt;tt&gt;Client.first(:conditions &amp;#8658; [&quot;orders_count = ?&quot;, params[:orders]])&lt;/tt&gt;. Active Record will go through the first element in the conditions value and any additional elements will replace the question marks (?) in the first element. If you want to specify two conditions, you can do it like &lt;tt&gt;Client.first(:conditions &amp;#8658; [&quot;orders_count = ? AND locked = ?&quot;, params[:orders], false])&lt;/tt&gt;. In this example, the first question mark will be replaced with the value in &lt;tt&gt;params[:orders]&lt;/tt&gt; and the second will be replaced with &lt;tt&gt;false&lt;/tt&gt; and this will find the first record in the table that has &lt;em&gt;2&lt;/em&gt; as its value for the &lt;tt&gt;orders_count&lt;/tt&gt; field and &lt;tt&gt;false&lt;/tt&gt; for its locked field.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;The reason for doing code like:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
 by Lorenzo Bettini
 http://www.lorenzobettini.it
 http://www.gnu.org/software/src-highlite --&gt;
-&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt;Client&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;first&lt;span style=&quot;color: #990000&quot;&gt;(:&lt;/span&gt;conditions &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;orders_count = ?&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; params&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;orders&lt;span style=&quot;color: #990000&quot;&gt;]])+&lt;/span&gt;
+&lt;pre&gt;&lt;tt&gt;Client&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;first&lt;span style=&quot;color: #990000&quot;&gt;(:&lt;/span&gt;conditions &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;orders_count = ?&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; params&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;orders&lt;span style=&quot;color: #990000&quot;&gt;]])&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;instead of:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
-&lt;div class=&quot;content&quot;&gt;
-&lt;pre&gt;&lt;tt&gt;+Client.first(:conditions =&amp;gt; &quot;orders_count = #{params[:orders]}&quot;)+&lt;/tt&gt;&lt;/pre&gt;
-&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;Client&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;first&lt;span style=&quot;color: #990000&quot;&gt;(:&lt;/span&gt;conditions &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;orders_count = #{params[:orders]}&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;is because of parameter safety. Putting the variable directly into the conditions string will pass the variable to the database &lt;strong&gt;as-is&lt;/strong&gt;. This means that it will be an unescaped variable directly from a user who may have malicious intent. If you do this, you put your entire database at risk because once a user finds out he or she can exploit your database they can do just about anything to it. Never ever put your parameters directly inside the conditions string.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;admonitionblock&quot;&gt;
 &lt;table&gt;&lt;tr&gt;
@@ -518,7 +538,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 by Lorenzo Bettini
 http://www.lorenzobettini.it
 http://www.gnu.org/software/src-highlite --&gt;
-&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;FROM&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt;users&lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;WHERE&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;created_at &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;IN&lt;/span&gt;&lt;/span&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;FROM&lt;/span&gt;&lt;/span&gt; users &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;WHERE&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;created_at &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;IN&lt;/span&gt;&lt;/span&gt;
   &lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;'2007-12-31'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;'2008-01-01'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;'2008-01-02'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;'2008-01-03'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;'2008-01-04'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;'2008-01-05'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;
   &lt;span style=&quot;color: #FF0000&quot;&gt;'2008-01-06'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;'2008-01-07'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;'2008-01-08'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;'2008-01-09'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;'2008-01-10'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;'2008-01-11'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;
   &lt;span style=&quot;color: #FF0000&quot;&gt;'2008-01-12'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;'2008-01-13'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;'2008-01-14'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;'2008-01-15'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;'2008-01-16'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;'2008-01-17'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt;
@@ -541,7 +561,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 by Lorenzo Bettini
 http://www.lorenzobettini.it
 http://www.gnu.org/software/src-highlite --&gt;
-&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;FROM&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt;users&lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;WHERE&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;created_at &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;IN&lt;/span&gt;&lt;/span&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;FROM&lt;/span&gt;&lt;/span&gt; users &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;WHERE&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;created_at &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;IN&lt;/span&gt;&lt;/span&gt;
   &lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;'2007-12-01 00:00:00'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'2007-12-01 00:00:01'&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;...&lt;/span&gt;
   &lt;span style=&quot;color: #FF0000&quot;&gt;'2007-12-01 23:59:59'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'2007-12-02 00:00:00'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;))&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
@@ -570,7 +590,7 @@ http://www.gnu.org/software/src-highlite --&gt;
   &lt;span style=&quot;color: #990000&quot;&gt;[&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;&quot;created_at &amp;gt;= ? AND created_at &amp;lt;= ?&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; params&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;start_date&lt;span style=&quot;color: #990000&quot;&gt;],&lt;/span&gt; params&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;end_date&lt;span style=&quot;color: #990000&quot;&gt;]])&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;Just like in Ruby.&lt;/p&gt;&lt;/div&gt;
-&lt;h3 id=&quot;_hash_conditions&quot;&gt;4.3. Hash Conditions&lt;/h3&gt;
+&lt;h3 id=&quot;_placeholder_conditions&quot;&gt;4.3. Placeholder Conditions&lt;/h3&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;Similar to the array style of params you can also specify keys in your conditions:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
@@ -641,7 +661,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 by Lorenzo Bettini
 http://www.lorenzobettini.it
 http://www.gnu.org/software/src-highlite --&gt;
-&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;FROM&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt;orders&lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;GROUP&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;BY&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #009900&quot;&gt;date&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;created_at&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;FROM&lt;/span&gt;&lt;/span&gt; orders &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;GROUP&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;BY&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #009900&quot;&gt;date&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;created_at&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;/div&gt;
 &lt;h2 id=&quot;_read_only&quot;&gt;9. Read Only&lt;/h2&gt;
@@ -730,20 +750,23 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;/div&gt;
 &lt;h2 id=&quot;_dynamic_finders&quot;&gt;13. Dynamic finders&lt;/h2&gt;
 &lt;div class=&quot;sectionbody&quot;&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;For every field (also known as an attribute) you define in your table, Active Record provides a finder method. If you have a field called &lt;tt&gt;name&lt;/tt&gt; on your Client model for example, you get &lt;tt&gt;find_by_name&lt;/tt&gt; and &lt;tt&gt;find_all_by_name&lt;/tt&gt; for free from Active Record. If you have also have a &lt;tt&gt;locked&lt;/tt&gt; field on the client model, you also get &lt;tt&gt;find_by_locked&lt;/tt&gt; and &lt;tt&gt;find_all_by_locked&lt;/tt&gt;. If you want to find both by name and locked, you can chain these finders together by simply typing &lt;tt&gt;and&lt;/tt&gt; between the fields for example &lt;tt&gt;Client.find_by_name_and_locked(&lt;em&gt;Ryan&lt;/em&gt;, true)&lt;/tt&gt;. These finders are an excellent alternative to using the conditions option, mainly because it's shorter to type &lt;tt&gt;find_by_name(params[:name])&lt;/tt&gt; than it is to type &lt;tt&gt;first(:conditions &amp;#8658; [&quot;name = ?&quot;, params[:name]])&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;For every field (also known as an attribute) you define in your table, Active Record provides a finder method. If you have a field called &lt;tt&gt;name&lt;/tt&gt; on your Client model for example, you get &lt;tt&gt;find_by_name&lt;/tt&gt; and &lt;tt&gt;find_all_by_name&lt;/tt&gt; for free from Active Record. If you have also have a &lt;tt&gt;locked&lt;/tt&gt; field on the client model, you also get &lt;tt&gt;find_by_locked&lt;/tt&gt; and &lt;tt&gt;find_all_by_locked&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;You can do &lt;tt&gt;find_last_by_*&lt;/tt&gt; methods too which will find the last record matching your parameter.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;You can specify an exclamation point (!) on the end of the dynamic finders to get them to raise an &lt;tt&gt;ActiveRecord::RecordNotFound&lt;/tt&gt; error if they do not return any records, like &lt;tt&gt;Client.find_by_name!(&lt;em&gt;Ryan&lt;/em&gt;)&lt;/tt&gt;&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;If you want to find both by name and locked, you can chain these finders together by simply typing &lt;tt&gt;and&lt;/tt&gt; between the fields for example &lt;tt&gt;Client.find_by_name_and_locked(&lt;em&gt;Ryan&lt;/em&gt;, true)&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;There's another set of dynamic finders that let you find or create/initialize objects if they aren't find. These work in a similar fashion to the other finders and can be used like &lt;tt&gt;find_or_create_by_name(params[:name])&lt;/tt&gt;. Using this will firstly perform a find and then create if the find returns nil. The SQL looks like this for &lt;tt&gt;Client.find_or_create_by_name(&lt;em&gt;Ryan&lt;/em&gt;)&lt;/tt&gt;:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
 by Lorenzo Bettini
 http://www.lorenzobettini.it
 http://www.gnu.org/software/src-highlite --&gt;
-&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;FROM&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt;clients&lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;WHERE&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;(+&lt;/span&gt;clients&lt;span style=&quot;color: #990000&quot;&gt;+.+&lt;/span&gt;name&lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'Ryan'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;LIMIT&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #993399&quot;&gt;1&lt;/span&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;*&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;FROM&lt;/span&gt;&lt;/span&gt; clients &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;WHERE&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;clients&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;name &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'Ryan'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;LIMIT&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #993399&quot;&gt;1&lt;/span&gt;
 BEGIN
-&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;INSERT&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;INTO&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt;clients&lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;(+&lt;/span&gt;name&lt;span style=&quot;color: #990000&quot;&gt;+,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt;updated_at&lt;span style=&quot;color: #990000&quot;&gt;+,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt;created_at&lt;span style=&quot;color: #990000&quot;&gt;+,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt;orders_count&lt;span style=&quot;color: #990000&quot;&gt;+,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt;locked&lt;span style=&quot;color: #990000&quot;&gt;+)&lt;/span&gt;
+&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;INSERT&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;INTO&lt;/span&gt;&lt;/span&gt; clients &lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;name&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; updated_at&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; created_at&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; orders_count&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; locked&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
   &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;VALUES&lt;/span&gt;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #FF0000&quot;&gt;'Ryan'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'2008-09-28 15:39:12'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'2008-09-28 15:39:12'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'0'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'0'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
 COMMIT
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;find_or_create&lt;/tt&gt;'s sibling, &lt;tt&gt;find_or_initialize&lt;/tt&gt;, will find an object and if it does not exist will call &lt;tt&gt;new&lt;/tt&gt; with the parameters you passed in. For example:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;find_or_create&lt;/tt&gt;'s sibling, &lt;tt&gt;find_or_initialize&lt;/tt&gt;, will find an object and if it does not exist will act similar to calling &lt;tt&gt;new&lt;/tt&gt; with the parameters you passed in. For example:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
 by Lorenzo Bettini
@@ -951,7 +974,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 by Lorenzo Bettini
 http://www.lorenzobettini.it
 http://www.gnu.org/software/src-highlite --&gt;
-&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt; count&lt;span style=&quot;color: #990000&quot;&gt;(*)&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;AS&lt;/span&gt;&lt;/span&gt; count_all &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;FROM&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt;clients&lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;WHERE&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;first_name &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #993399&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt; count&lt;span style=&quot;color: #990000&quot;&gt;(*)&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;AS&lt;/span&gt;&lt;/span&gt; count_all &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;FROM&lt;/span&gt;&lt;/span&gt; clients &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;WHERE&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;first_name &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #993399&quot;&gt;1&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;You can also use &lt;tt&gt;include&lt;/tt&gt; or &lt;tt&gt;joins&lt;/tt&gt; for this to do something a little more complex:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
@@ -967,8 +990,8 @@ http://www.gnu.org/software/src-highlite --&gt;
 by Lorenzo Bettini
 http://www.lorenzobettini.it
 http://www.gnu.org/software/src-highlite --&gt;
-&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt; count&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;DISTINCT&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt;clients&lt;span style=&quot;color: #990000&quot;&gt;+.&lt;/span&gt;id&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;AS&lt;/span&gt;&lt;/span&gt; count_all &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;FROM&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt;clients&lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt;
-  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;LEFT&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;OUTER&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;JOIN&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt;orders&lt;span style=&quot;color: #990000&quot;&gt;+&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;ON&lt;/span&gt;&lt;/span&gt; orders&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;client_id &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; client&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;id &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;WHERE&lt;/span&gt;&lt;/span&gt;
+&lt;pre&gt;&lt;tt&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;SELECT&lt;/span&gt;&lt;/span&gt; count&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;DISTINCT&lt;/span&gt;&lt;/span&gt; clients&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;id&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;AS&lt;/span&gt;&lt;/span&gt; count_all &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;FROM&lt;/span&gt;&lt;/span&gt; clients
+  &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;LEFT&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;OUTER&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;JOIN&lt;/span&gt;&lt;/span&gt; orders &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;ON&lt;/span&gt;&lt;/span&gt; orders&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;client_id &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; client&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;id &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;WHERE&lt;/span&gt;&lt;/span&gt;
   &lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;clients&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;first_name &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'name'&lt;/span&gt; &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;AND&lt;/span&gt;&lt;/span&gt; orders&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;&lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;status&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'received'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;This code specifies &lt;tt&gt;clients.first_name&lt;/tt&gt; just in case one of the join tables has a field also called &lt;tt&gt;first_name&lt;/tt&gt; and it uses &lt;tt&gt;orders.status&lt;/tt&gt; because that's the name of our join table.&lt;/p&gt;&lt;/div&gt;
@@ -1028,6 +1051,21 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;div class=&quot;ilist&quot;&gt;&lt;ul&gt;
 &lt;li&gt;
 &lt;p&gt;
+November 23 2008: Added documentation for &lt;tt&gt;find_by_last&lt;/tt&gt; and &lt;tt&gt;find_by_bang!&lt;/tt&gt;
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+November 21 2008: Fixed all points specified in &lt;a href=&quot;http://rails.lighthouseapp.com/projects/16213-rails-guides/tickets/16-activerecord-finders#ticket-16-13&quot;&gt;this comment&lt;/a&gt; and &lt;a href=&quot;http://rails.lighthouseapp.com/projects/16213-rails-guides/tickets/16-activerecord-finders#ticket-16-14&quot;&gt;this comment&lt;/a&gt;
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
+November 18 2008: Fixed all points specified in &lt;a href=&quot;http://rails.lighthouseapp.com/projects/16213-rails-guides/tickets/16-activerecord-finders#ticket-16-11&quot;&gt;this comment&lt;/a&gt;
+&lt;/p&gt;
+&lt;/li&gt;
+&lt;li&gt;
+&lt;p&gt;
 November 8, 2008: Editing pass by &lt;a href=&quot;../authors.html#mgunderloy&quot;&gt;Mike Gunderloy&lt;/a&gt; . First release version.
 &lt;/p&gt;
 &lt;/li&gt;</diff>
      <filename>railties/doc/guides/html/finders.html</filename>
    </modified>
    <modified>
      <diff>@@ -566,6 +566,14 @@ http://www.lorenzobettini.it
 http://www.gnu.org/software/src-highlite --&gt;
 &lt;pre&gt;&lt;tt&gt;$ rails blog -d postgresql
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;After you create the blog application, switch to its folder to continue work directly in that application:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;$ cd blog
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;In any case, Rails will create a folder in your working directory called &lt;tt&gt;blog&lt;/tt&gt;. Open up that folder and explore its contents. Most of the work in this tutorial will happen in the &lt;tt&gt;app/&lt;/tt&gt; folder, but here's a basic rundown on the function of each folder that Rails creates in a new application by default:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;tableblock&quot;&gt;
 &lt;table rules=&quot;all&quot;
@@ -764,6 +772,15 @@ http://www.gnu.org/software/src-highlite --&gt;
   password&lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;Change the username and password in the &lt;tt&gt;development&lt;/tt&gt; section as appropriate.&lt;/p&gt;&lt;/div&gt;
+&lt;h4 id=&quot;_creating_the_database&quot;&gt;3.3.4. Creating the Database&lt;/h4&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Now that you have your database configured, it's time to have Rails create an empty database for you. You can do this by running a rake command:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;listingblock&quot;&gt;
+&lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
+by Lorenzo Bettini
+http://www.lorenzobettini.it
+http://www.gnu.org/software/src-highlite --&gt;
+&lt;pre&gt;&lt;tt&gt;$ rake db&lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;create
+&lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;/div&gt;
 &lt;h2 id=&quot;_hello_rails&quot;&gt;4. Hello, Rails!&lt;/h2&gt;
 &lt;div class=&quot;sectionbody&quot;&gt;
@@ -1031,7 +1048,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;If you were to translate that into words, it says something like: when this migration is run, create a table named &lt;tt&gt;posts&lt;/tt&gt; with two string columns (&lt;tt&gt;name&lt;/tt&gt; and &lt;tt&gt;title&lt;/tt&gt;) and a text column (&lt;tt&gt;content&lt;/tt&gt;), and generate timestamp fields to track record creation and updating. You can learn the detailed syntax for migrations in the &lt;a href=&quot;../migrations.html&quot;&gt;Rails Database Migrations&lt;/a&gt; guide.&lt;/p&gt;&lt;/div&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;At this point, you need to do two things: create the database and run the migration. You can use rake commands at the terminal for both of those tasks:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;At this point, you can use a rake command to run the migration:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
 by Lorenzo Bettini
@@ -1045,7 +1062,7 @@ $ rake db&lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;migrate
 &lt;td class=&quot;icon&quot;&gt;
 &lt;img src=&quot;./images/icons/note.png&quot; alt=&quot;Note&quot; /&gt;
 &lt;/td&gt;
-&lt;td class=&quot;content&quot;&gt;Because you're working in the development environment by default, both of these commands will apply to the database defined in the &lt;tt&gt;development&lt;/tt&gt; section of your &lt;tt&gt;config/database.yml&lt;/tt&gt; file.&lt;/td&gt;
+&lt;td class=&quot;content&quot;&gt;Because you're working in the development environment by default, this command will apply to the database defined in the &lt;tt&gt;development&lt;/tt&gt; section of your &lt;tt&gt;config/database.yml&lt;/tt&gt; file.&lt;/td&gt;
 &lt;/tr&gt;&lt;/table&gt;
 &lt;/div&gt;
 &lt;h3 id=&quot;_adding_a_link&quot;&gt;6.2. Adding a Link&lt;/h3&gt;
@@ -1456,7 +1473,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;div class=&quot;sectionbody&quot;&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;At this point, it&#8217;s worth looking at some of the tools that Rails provides to eliminate duplication in your code. In particular, you can use &lt;em&gt;partials&lt;/em&gt; to clean up duplication in views and &lt;em&gt;filters&lt;/em&gt; to help with duplication in controllers.&lt;/p&gt;&lt;/div&gt;
 &lt;h3 id=&quot;_using_partials_to_eliminate_view_duplication&quot;&gt;7.1. Using Partials to Eliminate View Duplication&lt;/h3&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;As you saw earlier, the scaffold-generated views for the &lt;tt&gt;new&lt;/tt&gt; and &lt;tt&gt;edit&lt;/tt&gt; actions are largely identical. You can pull the shared code out into a &lt;tt&gt;partial&lt;/tt&gt; template. This requires editing the new and edit views, and adding a new template:&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;As you saw earlier, the scaffold-generated views for the &lt;tt&gt;new&lt;/tt&gt; and &lt;tt&gt;edit&lt;/tt&gt; actions are largely identical. You can pull the shared code out into a &lt;tt&gt;partial&lt;/tt&gt; template. This requires editing the new and edit views, and adding a new template. The new &lt;tt&gt;_form.html.erb&lt;/tt&gt; template should be saved in the same &lt;tt&gt;app/views/posts&lt;/tt&gt; folder as the files from which it is being extracted:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;&lt;tt&gt;new.html.erb&lt;/tt&gt;:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;
 &lt;div class=&quot;content&quot;&gt;&lt;!-- Generator: GNU source-highlight 2.9
@@ -1791,7 +1808,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 
   &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; show
     &lt;span style=&quot;color: #009900&quot;&gt;@post&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; Post&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;find&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;params&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;post_id&lt;span style=&quot;color: #990000&quot;&gt;])&lt;/span&gt;
-    &lt;span style=&quot;color: #009900&quot;&gt;@comment&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; Comment&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;find&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;params&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;id&lt;span style=&quot;color: #990000&quot;&gt;])&lt;/span&gt;
+    &lt;span style=&quot;color: #009900&quot;&gt;@comment&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #009900&quot;&gt;@post&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;comments&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;find&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;params&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;id&lt;span style=&quot;color: #990000&quot;&gt;])&lt;/span&gt;
   &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 
   &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; new
@@ -1803,7 +1820,7 @@ http://www.gnu.org/software/src-highlite --&gt;
     &lt;span style=&quot;color: #009900&quot;&gt;@post&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; Post&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;find&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;params&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;post_id&lt;span style=&quot;color: #990000&quot;&gt;])&lt;/span&gt;
     &lt;span style=&quot;color: #009900&quot;&gt;@comment&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #009900&quot;&gt;@post&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;comments&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;build&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;params&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;comment&lt;span style=&quot;color: #990000&quot;&gt;])&lt;/span&gt;
     &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;if&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #009900&quot;&gt;@comment&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;save
-      redirect_to post_comment_path&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900&quot;&gt;@post&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #009900&quot;&gt;@comment&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+      redirect_to post_comment_url&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900&quot;&gt;@post&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #009900&quot;&gt;@comment&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
     &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;else&lt;/span&gt;&lt;/span&gt;
       render &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;action &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;new&quot;&lt;/span&gt;
     &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
@@ -1811,14 +1828,14 @@ http://www.gnu.org/software/src-highlite --&gt;
 
   &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; edit
     &lt;span style=&quot;color: #009900&quot;&gt;@post&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; Post&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;find&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;params&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;post_id&lt;span style=&quot;color: #990000&quot;&gt;])&lt;/span&gt;
-    &lt;span style=&quot;color: #009900&quot;&gt;@comment&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; Comment&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;find&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;params&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;id&lt;span style=&quot;color: #990000&quot;&gt;])&lt;/span&gt;
+    &lt;span style=&quot;color: #009900&quot;&gt;@comment&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; &lt;span style=&quot;color: #009900&quot;&gt;@post&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;comments&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;find&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;params&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;id&lt;span style=&quot;color: #990000&quot;&gt;])&lt;/span&gt;
   &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
 
   &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;def&lt;/span&gt;&lt;/span&gt; update
     &lt;span style=&quot;color: #009900&quot;&gt;@post&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; Post&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;find&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;params&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;post_id&lt;span style=&quot;color: #990000&quot;&gt;])&lt;/span&gt;
     &lt;span style=&quot;color: #009900&quot;&gt;@comment&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;=&lt;/span&gt; Comment&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;find&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;params&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;id&lt;span style=&quot;color: #990000&quot;&gt;])&lt;/span&gt;
     &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;if&lt;/span&gt;&lt;/span&gt; &lt;span style=&quot;color: #009900&quot;&gt;@comment&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;update_attributes&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;params&lt;span style=&quot;color: #990000&quot;&gt;[:&lt;/span&gt;comment&lt;span style=&quot;color: #990000&quot;&gt;])&lt;/span&gt;
-      redirect_to post_comment_path&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900&quot;&gt;@post&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #009900&quot;&gt;@comment&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
+      redirect_to post_comment_url&lt;span style=&quot;color: #990000&quot;&gt;(&lt;/span&gt;&lt;span style=&quot;color: #009900&quot;&gt;@post&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #009900&quot;&gt;@comment&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;)&lt;/span&gt;
     &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;else&lt;/span&gt;&lt;/span&gt;
       render &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;action &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;edit&quot;&lt;/span&gt;
     &lt;span style=&quot;font-weight: bold&quot;&gt;&lt;span style=&quot;color: #0000FF&quot;&gt;end&lt;/span&gt;&lt;/span&gt;
@@ -1990,7 +2007,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;div class=&quot;ilist&quot;&gt;&lt;ul&gt;
 &lt;li&gt;
 &lt;p&gt;
-The &lt;a href=&quot;http://manuals.rubyonrails.org/&quot;&gt;Ruby On Rails guides&lt;/a&gt;
+The &lt;a href=&quot;http://guides.rubyonrails.org/&quot;&gt;Ruby On Rails guides&lt;/a&gt;
 &lt;/p&gt;
 &lt;/li&gt;
 &lt;li&gt;</diff>
      <filename>railties/doc/guides/html/getting_started_with_rails.html</filename>
    </modified>
    <modified>
      <diff>@@ -338,6 +338,19 @@ of your code.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;sidebar-title&quot;&gt;&lt;a href=&quot;creating_plugins.html&quot;&gt;The Basics of Creating Rails Plugins&lt;/a&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;This guide covers how to build a plugin to extend the functionality of Rails.&lt;/p&gt;&lt;/div&gt;
 &lt;/div&gt;&lt;/div&gt;
+&lt;div class=&quot;sidebarblock&quot;&gt;
+&lt;div class=&quot;sidebar-content&quot;&gt;
+&lt;div class=&quot;sidebar-title&quot;&gt;&lt;a href=&quot;i18n.html&quot;&gt;The Rails Internationalization API&lt;/a&gt;&lt;/div&gt;
+&lt;div class=&quot;admonitionblock&quot;&gt;
+&lt;table&gt;&lt;tr&gt;
+&lt;td class=&quot;icon&quot;&gt;
+&lt;img src=&quot;./images/icons/caution.png&quot; alt=&quot;Caution&quot; /&gt;
+&lt;/td&gt;
+&lt;td class=&quot;content&quot;&gt;still a basic draft&lt;/td&gt;
+&lt;/tr&gt;&lt;/table&gt;
+&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;This guide introduces you to the basic concepts and features of the Rails I18n API and shows you how to localize your application.&lt;/p&gt;&lt;/div&gt;
+&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;Authors who have contributed to complete guides are listed &lt;a href=&quot;authors.html&quot;&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;This work is licensed under a &lt;a href=&quot;http://creativecommons.org/licenses/by-nc-sa/3.0/&quot;&gt;Creative Commons Attribution-Noncommercial-Share Alike 3.0  License&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
 &lt;/div&gt;</diff>
      <filename>railties/doc/guides/html/index.html</filename>
    </modified>
    <modified>
      <diff>@@ -279,7 +279,7 @@ ul#navMain {
 				&lt;h1&gt;Migrations&lt;/h1&gt;
 			&lt;div id=&quot;preamble&quot;&gt;
 &lt;div class=&quot;sectionbody&quot;&gt;
-&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Migrations are a convenient way for you to alter your database in a structured and organised manner. You could edit fragments of SQL by hand but you would then be responsible for telling other developers that they need to go and run it. You'd also have to keep track of which changes need to be run against the production machines next time you deploy. Active Record tracks which migrations have already been run so all you have to do is update your source and run &lt;tt&gt;rake db:migrate&lt;/tt&gt;. Active Record will work out which migrations should be run.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Migrations are a convenient way for you to alter your database in a structured and organised manner. You could edit fragments of SQL by hand but you would then be responsible for telling other developers that they need to go and run it. You'd also have to keep track of which changes need to be run against the production machines next time you deploy. Active Record tracks which migrations have already been run so all you have to do is update your source and run &lt;tt&gt;rake db:migrate&lt;/tt&gt;. Active Record will work out which migrations should be run. It will also update your db/schema.rb file to match the structure of your database.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;Migrations also allow you to describe these transformations using Ruby. The great thing about this is that (like most of Active Record's functionality) it is database independent: you don't need to worry about the precise syntax of CREATE TABLE any more that you worry about variations on SELECT * (you can drop down to raw SQL for database specific features). For example you could use SQLite3 in development, but MySQL in production.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;You'll learn all about migrations including:&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;ilist&quot;&gt;&lt;ul&gt;
@@ -699,6 +699,7 @@ displayed saying that it can't be done.&lt;/p&gt;&lt;/div&gt;
 &lt;h2 id=&quot;_running_migrations&quot;&gt;4. Running Migrations&lt;/h2&gt;
 &lt;div class=&quot;sectionbody&quot;&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;Rails provides a set of rake tasks to work with migrations which boils down to running certain sets of migrations. The very first migration related rake task you use will probably be &lt;tt&gt;db:migrate&lt;/tt&gt;. In its most basic form it just runs the &lt;tt&gt;up&lt;/tt&gt; method for all the migrations that have not yet been run. If there are no such migrations it exits.&lt;/p&gt;&lt;/div&gt;
+&lt;div class=&quot;para&quot;&gt;&lt;p&gt;Note that running the &lt;tt&gt;db:migrate&lt;/tt&gt; also invokes the &lt;tt&gt;db:schema:dump&lt;/tt&gt; task, which will update your db/schema.rb file to match the structure of your database.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;If you specify a target version, Active Record will run the required migrations (up or down) until it has reached the specified version. The
 version is the numerical prefix on the migration's filename. For example to migrate to version 20080906120000 run&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;listingblock&quot;&gt;</diff>
      <filename>railties/doc/guides/html/migrations.html</filename>
    </modified>
    <modified>
      <diff>@@ -1454,7 +1454,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 &lt;td class=&quot;icon&quot;&gt;
 &lt;img src=&quot;./images/icons/tip.png&quot; alt=&quot;Tip&quot; /&gt;
 &lt;/td&gt;
-&lt;td class=&quot;content&quot;&gt;If your application has many RESTful routes, using &lt;tt&gt;:only&lt;/tt&gt; and &lt;tt&gt;:accept&lt;/tt&gt; to generate only the routes that you actually need can cut down on memory use and speed up the routing process.&lt;/td&gt;
+&lt;td class=&quot;content&quot;&gt;If your application has many RESTful routes, using &lt;tt&gt;:only&lt;/tt&gt; and &lt;tt&gt;:except&lt;/tt&gt; to generate only the routes that you actually need can cut down on memory use and speed up the routing process.&lt;/td&gt;
 &lt;/tr&gt;&lt;/table&gt;
 &lt;/div&gt;
 &lt;h3 id=&quot;_nested_resources&quot;&gt;3.8. Nested Resources&lt;/h3&gt;
@@ -1905,7 +1905,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 by Lorenzo Bettini
 http://www.lorenzobettini.it
 http://www.gnu.org/software/src-highlite --&gt;
-&lt;pre&gt;&lt;tt&gt;map&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;connect &lt;span style=&quot;color: #FF0000&quot;&gt;'photo/:id'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;controller &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'photos'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;action &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'show'&lt;/span&gt;
+&lt;pre&gt;&lt;tt&gt;map&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;connect &lt;span style=&quot;color: #FF0000&quot;&gt;'photos/:id'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;controller &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'photos'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;action &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'show'&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;With this route, an incoming URL of &lt;tt&gt;/photos/12&lt;/tt&gt; would be dispatched to the &lt;tt&gt;show&lt;/tt&gt; action within the &lt;tt&gt;Photos&lt;/tt&gt; controller.&lt;/p&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;You an also define other defaults in a route by supplying a hash for the &lt;tt&gt;:defaults&lt;/tt&gt; option. This even applies to parameters that are not explicitly defined elsewhere in the route. For example:&lt;/p&gt;&lt;/div&gt;
@@ -1914,7 +1914,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 by Lorenzo Bettini
 http://www.lorenzobettini.it
 http://www.gnu.org/software/src-highlite --&gt;
-&lt;pre&gt;&lt;tt&gt;map&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;connect &lt;span style=&quot;color: #FF0000&quot;&gt;'photo/:id'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;controller &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'photos'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;action &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'show'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;defaults &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;{&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;format &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'jpg'&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;}&lt;/span&gt;
+&lt;pre&gt;&lt;tt&gt;map&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;connect &lt;span style=&quot;color: #FF0000&quot;&gt;'photos/:id'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;controller &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'photos'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;action &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'show'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;defaults &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;{&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;format &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;'jpg'&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;}&lt;/span&gt;
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;With this route, an incoming URL of &lt;tt&gt;photos/12&lt;/tt&gt; would be dispatched to the &lt;tt&gt;show&lt;/tt&gt; action within the &lt;tt&gt;Photos&lt;/tt&gt; controller, and &lt;tt&gt;params[:format]&lt;/tt&gt; will be set to &lt;tt&gt;jpg&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;
 &lt;h3 id=&quot;_named_routes_2&quot;&gt;4.6. Named Routes&lt;/h3&gt;
@@ -2056,7 +2056,7 @@ http://www.gnu.org/software/src-highlite --&gt;
 by Lorenzo Bettini
 http://www.lorenzobettini.it
 http://www.gnu.org/software/src-highlite --&gt;
-&lt;pre&gt;&lt;tt&gt;map&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;index &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;controller &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;pages&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;action &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;main&quot;&lt;/span&gt;
+&lt;pre&gt;&lt;tt&gt;map&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;index &lt;span style=&quot;color: #FF0000&quot;&gt;'index'&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;controller &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;pages&quot;&lt;/span&gt;&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;action &lt;span style=&quot;color: #990000&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span style=&quot;color: #FF0000&quot;&gt;&quot;main&quot;&lt;/span&gt;
 map&lt;span style=&quot;color: #990000&quot;&gt;.&lt;/span&gt;root &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;index
 &lt;/tt&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
 &lt;div class=&quot;para&quot;&gt;&lt;p&gt;Because of the top-down processing of the file, the named route must be specified &lt;em&gt;before&lt;/em&gt; the call to &lt;tt&gt;map.root&lt;/tt&gt;.&lt;/p&gt;&lt;/div&gt;</diff>
      <filename>railties/doc/guides/html/routing_outside_in.html</filename>
    </modified>
    <modified>
      <diff>@@ -265,7 +265,7 @@ map.resources :products, :except =&gt; :destroy
 === Other Action Controller Changes
 
 * You can now easily link:http://m.onkey.org/2008/7/20/rescue-from-dispatching[show a custom error page] for exceptions raised while routing a request.
-* The HTTP Accept header is disabled by default now. You should prefer the use of formatted URLs (such as +/customers/1.xml+) to indicate the format that you want. If you need the Accept headers, you can turn them back on with +config.action_controller.user_accept_header = true+.
+* The HTTP Accept header is disabled by default now. You should prefer the use of formatted URLs (such as +/customers/1.xml+) to indicate the format that you want. If you need the Accept headers, you can turn them back on with +config.action_controller.use_accept_header = true+.
 * Benchmarking numbers are now reported in milliseconds rather than tiny fractions of seconds
 * Rails now supports HTTP-only cookies (and uses them for sessions), which help mitigate some cross-site scripting risks in newer browsers.
 * +redirect_to+ now fully supports URI schemes (so, for example, you can redirect to a svn+ssh: URI).
@@ -365,11 +365,11 @@ Lead Contributor: link:http://workingwithrails.com/person/5830-daniel-schierbeck
 * Extensive updates to +ActiveSupport::Multibyte+, including Ruby 1.9 compatibility fixes.
 * The addition of +ActiveSupport::Rescuable+ allows any class to mix in the +rescue_from+ syntax.
 * +past?+, +today?+ and +future?+ for +Date+ and +Time+ classes to facilitate date/time comparisons.
-* +Array#second+ through +Array#tenth+ as aliases for +Array#[1]+ through +Array#[9]+
+* +Array#second+ through +Array#fifth+ as aliases for +Array#[1]+ through +Array#[4]+
 * +Enumerable#many?+ to encapsulate +collection.size &gt; 1+
 * +Inflector#parameterize+ produces a URL-ready version of its input, for use in +to_param+.
 * +Time#advance+ recognizes fractional days and weeks, so you can do +1.7.weeks.ago+, +1.5.hours.since+, and so on.
-* The included TzInfo library has been upgraded to version 0.3.11.
+* The included TzInfo library has been upgraded to version 0.3.12.
 * +ActiveSuport::StringInquirer+ gives you a pretty way to test for equality in strings: +ActiveSupport::StringInquirer.new(&quot;abc&quot;).abc? =&gt; true+
 
 == Railties
@@ -381,7 +381,7 @@ In Railties (the core code of Rails itself) the biggest changes are in the +conf
 To avoid deployment issues and make Rails applications more self-contained, it's possible to place copies of all of the gems that your Rails application requires in +/vendor/gems+. This capability first appeared in Rails 2.1, but it's much more flexible and robust in Rails 2.2, handling complicated dependencies between gems. Gem management in Rails includes these commands:
 
 * +config.gem _gem_name_+ in your +config/environment.rb+ file
-* +rake gems+ to list all configured gems, as well as whether they (and their dependencies) are installed or frozen
+* +rake gems+ to list all configured gems, as well as whether they (and their dependencies) are installed, frozen, or framework (framework gems are those loaded by Rails before the gem dependency code is executed; such gems cannot be frozen)
 * +rake gems:install+ to install missing gems to the computer
 * +rake gems:unpack+ to place a copy of the required gems into +/vendor/gems+
 * +rake gems:unpack:dependencies+ to get copies of the required gems and their dependencies into +/vendor/gems+
@@ -394,6 +394,7 @@ You can unpack or install a single gem by specifying +GEM=_gem_name_+ on the com
 * More information:
  - link:http://ryandaigle.com/articles/2008/4/1/what-s-new-in-edge-rails-gem-dependencies[What's New in Edge Rails: Gem Dependencies]
  - link:http://afreshcup.com/2008/10/25/rails-212-and-22rc1-update-your-rubygems/[Rails 2.1.2 and 2.2RC1: Update Your RubyGems]
+ - link:http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1128[Detailed discussion on Lighthouse]
 
 === Other Railties Changes
 </diff>
      <filename>railties/doc/guides/source/2_2_release_notes.txt</filename>
    </modified>
    <modified>
      <diff>@@ -31,4 +31,4 @@ class CommentsController &lt; ApplicationController
 end
 -----------------------------------------
 
-Note that while for session values, you set the key to `nil`, to delete a cookie value, you should use `cookies.delete(:key)`.
+Note that while for session values you set the key to `nil`, to delete a cookie value you should use `cookies.delete(:key)`.</diff>
      <filename>railties/doc/guides/source/actioncontroller_basics/cookies.txt</filename>
    </modified>
    <modified>
      <diff>@@ -38,7 +38,7 @@ class ApplicationController &lt; ActionController::Base
 end
 ---------------------------------
 
-In this example, the filter is added to ApplicationController and thus all controllers in the application. This will make everything in the application require the user to be logged in in order to use it. For obvious reasons (the user wouldn't be able to log in in the first place!), not all controllers or actions should require this. You can prevent this filter from running before particular actions with `skip_before_filter` :
+In this example, the filter is added to ApplicationController and thus all controllers in the application. This will make everything in the application require the user to be logged in in order to use it. For obvious reasons (the user wouldn't be able to log in in the first place!), not all controllers or actions should require this. You can prevent this filter from running before particular actions with `skip_before_filter`:
 
 [source, ruby]
 ---------------------------------
@@ -49,7 +49,7 @@ class LoginsController &lt; Application
 end
 ---------------------------------
 
-Now, the +LoginsController+'s &quot;new&quot; and &quot;create&quot; actions will work as before without requiring the user to be logged in. The `:only` option is used to only skip this filter for these actions, and there is also an `:except` option which works the other way. These options can be used when adding filters too, so you can add a filter which only runs for selected actions in the first place.
+Now, the LoginsController's `new` and `create` actions will work as before without requiring the user to be logged in. The `:only` option is used to only skip this filter for these actions, and there is also an `:except` option which works the other way. These options can be used when adding filters too, so you can add a filter which only runs for selected actions in the first place.
 
 === After Filters and Around Filters ===
 </diff>
      <filename>railties/doc/guides/source/actioncontroller_basics/filters.txt</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 == Parameter Filtering ==
 
-Rails keeps a log file for each environment (development, test and production) in the &quot;log&quot; folder. These are extremely useful when debugging what's actually going on in your application, but in a live application you may not want every bit of information to be stored in the log file. The `filter_parameter_logging` method can be used to filter out sensitive information from the log. It works by replacing certain values in the `params` hash with &quot;[FILTERED]&quot; as they are written to the log. As an example, let's see how to filter all parameters with keys that include &quot;password&quot;:
+Rails keeps a log file for each environment (development, test and production) in the `log` folder. These are extremely useful when debugging what's actually going on in your application, but in a live application you may not want every bit of information to be stored in the log file. The `filter_parameter_logging` method can be used to filter out sensitive information from the log. It works by replacing certain values in the `params` hash with &quot;[FILTERED]&quot; as they are written to the log. As an example, let's see how to filter all parameters with keys that include &quot;password&quot;:
 
 [source, ruby]
 -------------------------
@@ -11,4 +11,4 @@ class ApplicationController &lt; ActionController::Base
 end
 -------------------------
 
-The method works recursively through all levels of the params hash and takes an optional second parameter which is used as the replacement string if present. It can also take a block which receives each key in return and replaces those for which the block returns true.
+The method works recursively through all levels of the params hash and takes an optional second parameter which is used as the replacement string if present. It can also take a block which receives each key in turn and replaces those for which the block returns true.</diff>
      <filename>railties/doc/guides/source/actioncontroller_basics/parameter_filtering.txt</filename>
    </modified>
    <modified>
      <diff>@@ -7,13 +7,13 @@ In every controller there are two accessor methods pointing to the request and t
 The request object contains a lot of useful information about the request coming in from the client. To get a full list of the available methods, refer to the link:http://api.rubyonrails.org/classes/ActionController/AbstractRequest.html[API documentation]. Among the properties that you can access on this object are:
 
  * host - The hostname used for this request.
- * domain - The hostname without the first segment (usually &quot;www&quot;).
+ * domain(n=2) - The hostname's first `n` segments, starting from the right (the TLD)
  * format - The content type requested by the client.
  * method - The HTTP method used for the request.
- * get?, post?, put?, delete?, head? - Returns true if the HTTP method is get/post/put/delete/head.
+ * get?, post?, put?, delete?, head? - Returns true if the HTTP method is GET/POST/PUT/DELETE/HEAD.
  * headers - Returns a hash containing the headers associated with the request.
  * port - The port number (integer) used for the request.
- * protocol - The protocol used for the request.
+ * protocol - Returns a string containing the prototol used plus &quot;://&quot;, for example &quot;http://&quot;
  * query_string - The query string part of the URL - everything after &quot;?&quot;.
  * remote_ip - The IP address of the client.
  * url - The entire URL used for the request.</diff>
      <filename>railties/doc/guides/source/actioncontroller_basics/request_response_objects.txt</filename>
    </modified>
    <modified>
      <diff>@@ -52,7 +52,7 @@ This will read and stream the file 4Kb at the time, avoiding loading the entire
 
 WARNING: Be careful when using (or just don't use) &quot;outside&quot; data (params, cookies, etc) to locate the file on disk, as this is a security risk that might allow someone to gain access to files they are not meant to see.
 
-TIP: It is not recommended that you stream static files through Rails if you can instead keep them in a public folder on your web server. It is much more efficient to let the user download the file directly using Apache or another web server, keeping the request from unnecessarily going through the whole Rails stack.
+TIP: It is not recommended that you stream static files through Rails if you can instead keep them in a public folder on your web server. It is much more efficient to let the user download the file directly using Apache or another web server, keeping the request from unnecessarily going through the whole Rails stack. Although if you do need the request to go through Rails for some reason, you can set the `:x_sendfile` option to true, and Rails will let the web server handle sending the file to the user, freeing up the Rails process to do other things. Note that your web server needs to support the `X-Sendfile` header for this to work, and you still have to be careful not to use user input in a way that lets someone retrieve arbitrary files.
 
 === RESTful Downloads ===
 </diff>
      <filename>railties/doc/guides/source/actioncontroller_basics/streaming.txt</filename>
    </modified>
    <modified>
      <diff>@@ -25,7 +25,7 @@ class LoginsController &lt; ApplicationController
 end
 ---------------------------------------
 
-Now the `create` action won't run unless the &quot;username&quot; and &quot;password&quot; parameters are present, and if they're not, an error message will be added to the flash and the &quot;new&quot; action will be rendered. But there's something rather important missing from the verification above: It will be used for *every* action in LoginsController, which is not what we want. You can limit which actions it will be used for with the `:only` and `:except` options just like a filter:
+Now the `create` action won't run unless the &quot;username&quot; and &quot;password&quot; parameters are present, and if they're not, an error message will be added to the flash and the `new` action will be rendered. But there's something rather important missing from the verification above: It will be used for *every* action in LoginsController, which is not what we want. You can limit which actions it will be used for with the `:only` and `:except` options just like a filter:
 
 [source, ruby]
 ---------------------------------------</diff>
      <filename>railties/doc/guides/source/actioncontroller_basics/verification.txt</filename>
    </modified>
    <modified>
      <diff>@@ -7,7 +7,7 @@ After reading this guide and trying out the presented concepts, we hope that you
 
 * Correctly use all the built-in Active Record validation helpers
 * Create your own custom validation methods
-* Work with the error messages generated by the validation proccess
+* Work with the error messages generated by the validation process
 * Register callback methods that will execute custom operations during your objects lifecycle, for example before/after they are saved.
 * Create special classes that encapsulate common behaviour for your callbacks
 * Create Observers - classes with callback methods specific for each of your models, keeping the callback code outside your models' declarations.
@@ -47,7 +47,9 @@ We can see how it works by looking at the following script/console output:
 =&gt; false
 ------------------------------------------------------------------
 
-Saving new records means sending an SQL insert operation to the database, while saving existing records (by calling either +save+, +update_attribute+ or +update_attributes+) will result in a SQL update operation. Active Record will use this facts to perform validations upon your objects, avoiding then to be recorded to the database if their inner state is invalid in some way. You can specify validations that will be beformed every time a object is saved, just when you're creating a new record or when you're updating an existing one.
+Saving new records means sending an SQL insert operation to the database, while saving existing records (by calling either +save+ or +update_attributes+) will result in a SQL update operation. Active Record will use this facts to perform validations upon your objects, avoiding then to be recorded to the database if their inner state is invalid in some way. You can specify validations that will be beformed every time a object is saved, just when you're creating a new record or when you're updating an existing one.
+
+CAUTION: There are four methods that when called will trigger validation: +save+, +save!+, +update_attributes+ and +update_attributes!+. There is one method left, which is +update_attribute+. This method will update the value of an attribute without triggering any validation, so be careful when using +update_attribute+, since it can let you save your objects in an invalid state.
 
 === The meaning of 'valid'
 
@@ -301,7 +303,7 @@ There are some common options that all the validation helpers can use. Here they
 
 === The +:allow_nil+ option
 
-You may use the +:allow_nil+ option everytime you just want to trigger a validation if the value being validated is not +nil+. You may be asking yourself if it makes any sense to use +:allow_nil+ and +validates_presence_of+ together. Well, it does. Remember, validation will be skipped only for +nil+ attributes, but empty strings are not considered +nil+.
+You may use the +:allow_nil+ option everytime you want to trigger a validation only if the value being validated is not +nil+. You may be asking yourself if it makes any sense to use +:allow_nil+ and +validates_presence_of+ together. Well, it does. Remember, validation will be skipped only for +nil+ attributes, but empty strings are not considered +nil+.
 
 [source, ruby]
 ------------------------------------------------------------------
@@ -382,7 +384,7 @@ class Invoice &lt; ActiveRecord::Base
 end
 ------------------------------------------------------------------
 
-If your validation rules are too complicated and you want to break it in small methods, you can implement all of them and call one of +validate+, +validate_on_create+ or +validate_on_update+ methods, passing it the symbols for the methods' names.
+If your validation rules are too complicated and you want to break them in small methods, you can implement all of them and call one of +validate+, +validate_on_create+ or +validate_on_update+ methods, passing it the symbols for the methods' names.
 
 [source, ruby]
 ------------------------------------------------------------------
@@ -399,6 +401,284 @@ class Invoice &lt; ActiveRecord::Base
 end
 ------------------------------------------------------------------
 
+== Using the +errors+ collection
+
+You can do more than just call +valid?+ upon your objects based on the existance of the +errors+ collection. Here is a list of the other available methods that you can use to manipulate errors or ask for an object's state.
+
+* +add_to_base+ lets you add errors messages that are related to the object's state as a whole, instead of being related to a specific attribute. You can use this method when you want to say that the object is invalid, no matter the values of it's attributes. +add_to_base+ receives a string with the message.
+
+[source, ruby]
+------------------------------------------------------------------
+class Person &lt; ActiveRecord::Base
+  def a_method_used_for_validation_purposes
+    errors.add_to_base(&quot;This person is invalid because ...&quot;)
+  end
+end
+------------------------------------------------------------------
+
+* +add+ lets you manually add messages that are related to particular attributes. When writing those messages, keep in mind that Rails will prepend them with the name of the attribute that holds the error, so write it in a way that makes sense. +add+ receives a symbol with the name of the attribute that you want to add the message to and the message itself.
+
+[source, ruby]
+------------------------------------------------------------------
+class Person &lt; ActiveRecord::Base
+  def a_method_used_for_validation_purposes
+    errors.add(:name, &quot;can't have the characters !@#$%*()_-+=&quot;)
+  end
+end
+------------------------------------------------------------------
+
+* +invalid?+ is used when you want to check if a particular attribute is invalid. It receives a symbol with the name of the attribute that you want to check.
+
+[source, ruby]
+------------------------------------------------------------------
+class Person &lt; ActiveRecord::Base
+  validates_presence_of :name, :email
+end
+
+person = Person.new(:name =&gt; &quot;John Doe&quot;)
+person.invalid?(:email) # =&gt; true
+------------------------------------------------------------------
+
+* +on+ is used when you want to check the error messages for a specific attribute. It will return different kinds of objects depending on the state of the +errors+ collection for the given attribute. If there are no errors related to the attribute, +on+ will return +nil+. If there is just one errors message for this attribute, +on+ will return a string with the message. When +errors+ holds two or more error messages for the attribute, +on+ will return an array of strings, each one with one error message.
+
+[source, ruby]
+------------------------------------------------------------------
+class Person &lt; ActiveRecord::Base
+  validates_presence_of :name
+  validates_length_of :name, :minimum =&gt; 3
+end
+
+person = Person.new(:name =&gt; &quot;John Doe&quot;)
+person.valid? # =&gt; true
+person.errors.on(:name) # =&gt; nil
+
+person = Person.new(:name =&gt; &quot;JD&quot;)
+person.valid? # =&gt; false
+person.errors.on(:name) # =&gt; &quot;is too short (minimum is 3 characters)&quot;
+
+person = Person.new
+person.valid? # =&gt; false
+person.errors.on(:name) # =&gt; [&quot;can't be blank&quot;, &quot;is too short (minimum is 3 characters)&quot;]
+------------------------------------------------------------------
+
+* +clear+ is used when you intentionally wants to clear all the messages in the +errors+ collection.
+
+[source, ruby]
+------------------------------------------------------------------
+class Person &lt; ActiveRecord::Base
+  validates_presence_of :name
+  validates_length_of :name, :minimum =&gt; 3
+end
+
+person = Person.new
+puts person.valid? # =&gt; false
+person.errors.on(:name) # =&gt; [&quot;can't be blank&quot;, &quot;is too short (minimum is 3 characters)&quot;]
+person.errors.clear
+person.errors # =&gt; nil
+------------------------------------------------------------------
+
+== Callbacks
+
+Callbacks are methods that get called at certain moments of an object's lifecycle. With callbacks it's possible to write code that will run whenever an Active Record object is created, saved, updated, deleted or loaded from the database.
+
+=== Callbacks registration
+
+In order to use the available callbacks, you need to registrate them. There are two ways of doing that. 
+
+=== Registering callbacks by overriding the callback methods
+
+You can specify the callback method directly, by overriding it. Let's see how it works using the +before_validation+ callback, which will surprisingly run right before any validation is done.
+
+[source, ruby]
+------------------------------------------------------------------
+class User &lt; ActiveRecord::Base
+  validates_presence_of :login, :email
+  
+  protected
+  def before_validation
+    if self.login.nil?
+      self.login = email unless email.blank?
+    end
+  end
+end
+------------------------------------------------------------------
+
+=== Registering callbacks by using macro-style class methods
+
+The other way you can register a callback method is by implementing it as an ordinary method, and then using a macro-style class method to register it as a callback. The last example could be written like that:
+
+[source, ruby]
+------------------------------------------------------------------
+class User &lt; ActiveRecord::Base
+  validates_presence_of :login, :email
+  
+  before_validation :ensure_login_has_a_value
+  
+  protected
+  def ensure_login_has_a_value
+    if self.login.nil?
+      self.login = email unless email.blank?
+    end
+  end  
+end
+------------------------------------------------------------------
+
+The macro-style class methods can also receive a block. Rails best practices say that you should only use this style of registration if the code inside your block is so short that it fits in just one line.
+
+[source, ruby]
+------------------------------------------------------------------
+class User &lt; ActiveRecord::Base
+  validates_presence_of :login, :email
+  
+  before_create {|user| user.name = user.login.capitalize if user.name.blank?}
+end
+------------------------------------------------------------------
+
+In Rails, the preferred way of registering callbacks is by using macro-style class methods. The main advantages of using macro-style class methods are:
+
+* You can add more than one method for each type of callback. Those methods will be queued for execution at the same order they were registered.
+* Readability, since your callback declarations will live at the beggining of your models' files.
+
+CAUTION: Remember to always declare the callback methods as being protected or private. These methods should never be public, otherwise it will be possible to call them from code outside the model, violating object encapsulation and exposing implementation details.
+
+== Available callbacks
+ 
+Here is a list with all the available Active Record callbacks, listed in the same order in which they will get called during the respective operations.
+
+=== Callbacks called both when creating or updating a record.
+
+* +before_validation+ 
+* +after_validation+ 
+* +before_save+ 
+* *INSERT OR UPDATE OPERATION*
+* +after_save+ 
+
+=== Callbacks called only when creating a new record.
+
+* +before_validation_on_create+ 
+* +after_validation_on_create+ 
+* +before_create+
+* *INSERT OPERATION*
+* +after_create+
+
+=== Callbacks called only when updating an existing record.
+
+* +before_validation_on_update+
+* +after_validation_on_update+
+* +before_update+
+* *UPDATE OPERATION*
+* +after_update+
+
+=== Callbacks called when removing a record from the database.
+
+* +before_destroy+
+* *DELETE OPERATION*
+* +after_destroy+
+
+The +before_destroy+ and +after_destroy+ callbacks will only be called if you delete the model using either the +destroy+ instance method or one of the +destroy+ or +destroy_all+ class methods of your Active Record class. If you use +delete+ or +delete_all+ no callback operations will run, since Active Record will not instantiate any objects, accessing the records to be deleted directly in the database.
+
+=== The +after_initialize+ and +after_find+ callbacks
+
+The +after_initialize+ callback will be called whenever an Active Record object is instantiated, either by direcly using +new+ or when a record is loaded from the database. It can be useful to avoid the need to directly override your Active Record +initialize+ method.
+
+The +after_find+ callback will be called whenever Active Record loads a record from the database. When used together with +after_initialize+ it will run first, since Active Record will first read the record from the database and them create the model object that will hold it. 
+
+The +after_initialize+ and +after_find+ callbacks are a bit different from the others, since the only way to register those callbacks is by defining them as methods. If you try to register +after_initialize+ or +after_find+ using macro-style class methods, they will just be ignored. This behaviour is due to performance reasons, since +after_initialize+ and +after_find+ will both be called for each record found in the database, significantly slowing down the queries.
+
+== Halting Execution
+
+As you start registering new callbacks for your models, they will be queued for execution. This queue will include all your model's validations, the registered callbacks and the database operation to be executed. However, if at any moment one of the callback methods returns a boolean +false+ (not +nil+) value, this execution chain will be halted and the desired operation will not complete: your model will not get persisted in the database, or your records will not get deleted and so on.
+
+== Callback classes
+
+Sometimes the callback methods that you'll write will be useful enough to be reused at other models. Active Record makes it possible to create classes that encapsulate the callback methods, so it becomes very easy to reuse them.
+
+Here's an example where we create a class with a after_destroy callback for a PictureFile model.
+
+[source, ruby]
+------------------------------------------------------------------
+class PictureFileCallbacks
+  def after_destroy(picture_file)
+    File.delete(picture_file.filepath) if File.exists?(picture_file.filepath)
+  end
+end
+------------------------------------------------------------------
+
+When declared inside a class the callback method will receive the model object as a parameter. We can now use it this way:
+
+[source, ruby]
+------------------------------------------------------------------
+class PictureFile &lt; ActiveRecord::Base
+  after_destroy PictureFileCallbacks.new
+end
+------------------------------------------------------------------
+
+Note that we needed to instantiate a new PictureFileCallbacks object, since we declared our callback as an instance method. Sometimes it will make more sense to have it as a class method.
+
+[source, ruby]
+------------------------------------------------------------------
+class PictureFileCallbacks
+  def self.after_destroy(picture_file)
+    File.delete(picture_file.filepath) if File.exists?(picture_file.filepath)
+  end
+end 
+------------------------------------------------------------------
+
+If the callback method is declared this way, it won't be necessary to instantiate a PictureFileCallbacks object.
+
+[source, ruby]
+------------------------------------------------------------------
+class PictureFile &lt; ActiveRecord::Base
+  after_destroy PictureFileCallbacks
+end
+------------------------------------------------------------------
+
+You can declare as many callbacks as you want inside your callback classes.
+
+== Observers
+
+Active Record callbacks are a powerful feature, but they can pollute your model implementation with code that's not directly related to the model's purpose. In object-oriented software, it's always a good idea to design your classes with a single responsability in the whole system. For example, it wouldn't make much sense to have a +User+ model with a method that writes data about a login attempt to a log file. Whenever you're using callbacks to write code that's not directly related to your model class purposes, it may be a good moment to create an Observer.
+
+An Active Record Observer is an object that links itself to a model and register it's methods for callbacks. Your model's implementation remain clean, while you can reuse the code in the Observer to add behaviuor to more than one model class. Ok, you may say that we can also do that using callback classes, but it would still force us to add code to our model's implementation.
+
+Observer classes are subclasses of the +ActiveRecord::Observer+ class. When this class is subclassed, Active Record will look at the name of the new class and then strip the 'Observer' part to find the name of the Active Record class to observe.
+
+Consider a +Registration+ model, where we want to send an email everytime a new registration is created. Since sending emails is not directly related to our model's purpose, we could create an Observer to do just that:
+
+[source, ruby]
+------------------------------------------------------------------
+class RegistrationObserver &lt; ActiveRecord::Observer
+  def after_create(model)
+    # code to send registration confirmation emails...
+  end
+end
+------------------------------------------------------------------
+
+Like in callback classes, the observer's methods receive the observed model as a parameter.
+
+Sometimes using the ModelName + Observer naming convention won't be the best choice, mainly when you want to use the same observer for more than one model class. It's possible to explicity specify the models that our observer should observe. 
+
+[source, ruby]
+------------------------------------------------------------------
+class Auditor &lt; ActiveRecord::Observer
+  observe User, Registration, Invoice
+end
+------------------------------------------------------------------
+
+=== Registering observers
+
+If you payed attention, you may be wondering where Active Record Observers are referenced in our applications, so they get instantiate and begin to interact with our models. For observers to work we need to register then in our application's *config/environment.rb* file. In this file there is a commented out line where we can define the observers that our application should load at start-up.
+
+[source, ruby]
+------------------------------------------------------------------
+# Activate observers that should always be running
+config.active_record.observers = :registration_observer, :auditor
+------------------------------------------------------------------
+
+=== Where to put the observers' source files
+
+By convention, you should always save your observers' source files inside *app/models*.
+
 == Changelog
 
 http://rails.lighthouseapp.com/projects/16213/tickets/26-active-record-validations-and-callbacks</diff>
      <filename>railties/doc/guides/source/activerecord_validations_callbacks.txt</filename>
    </modified>
    <modified>
      <diff>@@ -354,8 +354,8 @@ In designing a data model, you will sometimes find a model that should have a re
 [source, ruby]
 -------------------------------------------------------
 class Employee &lt; ActiveRecord::Base
-  has_many :subordinates, :class_name =&gt; &quot;User&quot;, :foreign_key =&gt; &quot;manager_id&quot;
-  belongs_to :manager, :class_name =&gt; &quot;User&quot;
+  has_many :subordinates, :class_name =&gt; &quot;Employee&quot;, :foreign_key =&gt; &quot;manager_id&quot;
+  belongs_to :manager, :class_name =&gt; &quot;Employee&quot;
 end
 -------------------------------------------------------
 
@@ -396,7 +396,11 @@ You are not free to use just any name for your associations. Because creating an
 
 === Updating the Schema
 
-Associations are extremely useful, but they are not magic. You are responsible for maintaining your database schema to match your associations. In practice, this means two things. First, you need to create foreign keys as appropriate:
+Associations are extremely useful, but they are not magic. You are responsible for maintaining your database schema to match your associations. In practice, this means two things, depending on what sort of associations you are creating. For +belongs_to+ associations you need to create foreign keys, and for +has_and_belongs_to_many+ associations you need to create the appropriate join table.
+
+==== Creating Foreign Keys for +belongs_to+ Associations
+
+When you declare a +belongs_to+ association, you need to create foreign keys as appropriate. For example, consider this model:
 
 [source, ruby]
 -------------------------------------------------------
@@ -412,9 +416,9 @@ This declaration needs to be backed up by the proper foreign key declaration on
 class CreateOrders &lt; ActiveRecord::Migration
   def self.up
     create_table :orders do |t|
-      t.order_date   :datetime
-      t.order_number :string
-      t.customer_id  :integer
+      t.datetime   :order_date
+      t.string     :order_number 
+      t.integer    :customer_id 
     end
   end
 
@@ -426,7 +430,9 @@ end
 
 If you create an association some time after you build the underlying model, you need to remember to create an +add_column+ migration to provide the necessary foreign key.
 
-Second, if you create a +has_and_belongs_to_many+ association, you need to explicitly create the joining table. Unless the name of the join table is explicitly specified by using the +:join_table+ option, Active Record create the name by using the lexical order of the class names. So a join between customer and order models will give the default join table name of &quot;customers_orders&quot; because &quot;c&quot; outranks &quot;o&quot; in lexical ordering. 
+==== Creating Join Tables for +has_and_belongs_to_many+ Associations
+
+If you create a +has_and_belongs_to_many+ association, you need to explicitly create the joining table. Unless the name of the join table is explicitly specified by using the +:join_table+ option, Active Record create the name by using the lexical order of the class names. So a join between customer and order models will give the default join table name of &quot;customers_orders&quot; because &quot;c&quot; outranks &quot;o&quot; in lexical ordering. 
 
 WARNING: The precedence between model names is calculated using the +&lt;+ operator for +String+. This means that if the strings are of different lengths, and the strings are equal when compared up to the shortest length, then the longer string is considered of higher lexical precedence than the shorter one. For example, one would expect the tables &quot;paper_boxes&quot; and &quot;papers&quot; to generate a join table name of &quot;papers_paper_boxes&quot; because of the length of the name &quot;paper_boxes&quot;, but it in fact generates a join table name of &quot;paper_boxes_papers&quot;.
 
@@ -1330,7 +1336,7 @@ end
 
 ===== +:offset+
 
-The +:offset+ option lets you specify the starting offset for fetching objects via an association. For example, if you set +:offset =&gt; 11+, it will skip the first 10 records.
+The +:offset+ option lets you specify the starting offset for fetching objects via an association. For example, if you set +:offset =&gt; 11+, it will skip the first 11 records.
 
 ===== +:order+
 
@@ -1698,7 +1704,7 @@ end
 
 ===== +:offset+
 
-The +:offset+ option lets you specify the starting offset for fetching objects via an association. For example, if you set +:offset =&gt; 11+, it will skip the first 10 records.
+The +:offset+ option lets you specify the starting offset for fetching objects via an association. For example, if you set +:offset =&gt; 11+, it will skip the first 11 records.
 
 ===== +:order+
 </diff>
      <filename>railties/doc/guides/source/association_basics.txt</filename>
    </modified>
    <modified>
      <diff>@@ -37,3 +37,9 @@ Heiko has rarely looked back.
 Tore Darell is an independent developer based in Menton, France who specialises in cruft-free web applications using Ruby, Rails
 and unobtrusive JavaScript. His home on the internet is his blog http://tore.darell.no/[Sneaky Abstractions].
 ***********************************************************
+
+.Jeff Dean
+[[zilkey]]
+***********************************************************
+Jeff Dean is a software engineer with http://pivotallabs.com/[Pivotal Labs].
+***********************************************************</diff>
      <filename>railties/doc/guides/source/authors.txt</filename>
    </modified>
    <modified>
      <diff>@@ -10,8 +10,8 @@ need to return to those hungry web clients in the shortest time possible.
 This is an introduction to the three types of caching techniques that Rails
 provides by default without the use of any third party plugins.
 
-To get started make sure config.action_controller.perform_caching is set
-to true for your environment. This flag is normally set in the
+To get started make sure `config.action_controller.perform_caching` is set
+to `true` for your environment. This flag is normally set in the
 corresponding config/environments/*.rb and caching is disabled by default
 there for development and test, and enabled for production.
 
@@ -45,21 +45,21 @@ end
 -----------------------------------------------------
 
 The first time anyone requests products/index, Rails will generate a file
-called index.html and the webserver will then look for that file before it
+called `index.html` and the webserver will then look for that file before it
 passes the next request for products/index to your Rails application.
 
 By default, the page cache directory is set to Rails.public_path (which is
-usually set to RAILS_ROOT + &quot;/public&quot;) and this can be configured by
-changing the configuration setting ActionController::Base.page_cache_directory. Changing the
-default from /public helps avoid naming conflicts, since you may want to
-put other static html in /public, but changing this will require web
-server reconfiguration to let the web server know where to serve the
-cached files from.
-
-The Page Caching mechanism will automatically add a .html exxtension to
+usually set to `RAILS_ROOT + &quot;/public&quot;`) and this can be configured by
+changing the configuration setting `config.action_controller.page_cache_directory`.
+Changing the default from /public helps avoid naming conflicts, since you may
+want to put other static html in /public, but changing this will require web
+server reconfiguration to let the web server know where to serve the cached
+files from.
+
+The Page Caching mechanism will automatically add a `.html` exxtension to
 requests for pages that do not have an extension to make it easy for the
 webserver to find those pages and this can be configured by changing the
-configuration setting ActionController::Base.page_cache_extension.
+configuration setting `config.action_controller.page_cache_extension`.
 
 In order to expire this page when a new product is added we could extend our
 example controler like this:
@@ -119,8 +119,8 @@ class ProductsController &lt; ActionController
 end
 -----------------------------------------------------
 
-And you can also use :if (or :unless) to pass a Proc that specifies when the
-action should be cached. Also, you can use :layout =&gt; false to cache without
+And you can also use `:if` (or `:unless`) to pass a Proc that specifies when the
+action should be cached. Also, you can use `:layout =&gt; false` to cache without
 layout so that dynamic information in the layout such as logged in user info
 or the number of items in the cart can be left uncached. This feature is
 available as of Rails 2.2.
@@ -164,7 +164,7 @@ could use this piece of code:
 
 The cache block in our example will bind to the action that called it and is
 written out to the same place as the Action Cache, which means that if you
-want to cache multiple fragments per action, you should provide an action_suffix to the cache call:
+want to cache multiple fragments per action, you should provide an `action_suffix` to the cache call:
 
 [source, ruby]
 -----------------------------------------------------
@@ -172,11 +172,29 @@ want to cache multiple fragments per action, you should provide an action_suffix
   All available products: 
 -----------------------------------------------------
 
-and you can expire it using the expire_fragment method, like so:
+and you can expire it using the `expire_fragment` method, like so:
 
 [source, ruby]
 -----------------------------------------------------
-expire_fragment(:controller =&gt; 'producst', :action =&gt; 'recent', :action_suffix =&gt; 'all_products)
+expire_fragment(:controller =&gt; 'products', :action =&gt; 'recent', :action_suffix =&gt; 'all_products)
+-----------------------------------------------------
+
+If you don't want the cache block to bind to the action that called it, You can
+also use globally keyed fragments by calling the cache method with a key, like
+so:
+
+[source, ruby]
+-----------------------------------------------------
+&lt;% cache(:key =&gt; ['all_available_products', @latest_product.created_at].join(':')) do %&gt;
+  All available products: 
+-----------------------------------------------------
+
+This fragment is then available to all actions in the ProductsController using
+the key and can be expired the same way:
+
+[source, ruby]
+-----------------------------------------------------
+expire_fragment(:key =&gt; ['all_available_products', @latest_product.created_at].join(':'))
 -----------------------------------------------------
 
 [More: more examples? description of fragment keys and expiration, etc? pagination?]
@@ -185,7 +203,7 @@ expire_fragment(:controller =&gt; 'producst', :action =&gt; 'recent', :action_suffix =
 
 Cache sweeping is a mechanism which allows you to get around having a ton of
 expire_{page,action,fragment} calls in your code by moving all the work
-required to expire cached content into a ActionController::Caching::Sweeper
+required to expire cached content into a `ActionController::Caching::Sweeper`
 class that is an Observer and looks for changes to an object via callbacks,
 and when a change occurs it expires the caches associated with that object n
 an around or after filter.
@@ -340,8 +358,7 @@ ActionController::Base.cache_store = :drb_store, &quot;druby://localhost:9192&quot;
 -----------------------------------------------------
 
 4) MemCached store: Works like DRbStore, but uses Danga's MemCache instead.
-                    Requires the ruby-memcache library:  
-                    gem install ruby-memcache.
+                    Rails uses the bundled memcached-client gem by default.
 
 [source, ruby]
 -----------------------------------------------------
@@ -355,6 +372,68 @@ ActionController::Base.cache_store = :mem_cache_store, &quot;localhost&quot;
 ActionController::Base.cache_store = MyOwnStore.new(&quot;parameter&quot;)
 -----------------------------------------------------
 
++Note: config.cache_store can be used in place of
+ActionController::Base.cache_store in your Rails::Initializer.run block in
+environment.rb+
+
+== Conditional GET support
+
+Conditional GETs are a facility of the HTTP spec that provide a way for web
+servers to tell browsers that the response to a GET request hasn&#8217;t changed
+since the last request and can be safely pulled from the browser cache.
+
+They work by using the HTTP_IF_NONE_MATCH and HTTP_IF_MODIFIED_SINCE headers to
+pass back and forth both a unique content identifier and the timestamp of when
+the content was last changed. If the browser makes a request where the content
+identifier (etag) or last modified since timestamp matches the server&#8217;s version
+then the server only needs to send back an empty response with a not modified
+status.
+
+It is the server&#8217;s (i.e. our) responsibility to look for a last modified
+timestamp and the if-none-match header and determine whether or not to send
+back the full response. With conditional-get support in rails this is a pretty
+easy task:
+
+[source, ruby]
+-----------------------------------------------------
+class ProductsController &lt; ApplicationController
+
+  def show
+    @product = Product.find(params[:id])
+
+    # If the request is stale according to the given timestamp and etag value
+    # (i.e. it needs to be processed again) then execute this block
+    if stale?(:last_modified =&gt; @product.updated_at.utc, :etag =&gt; @product)
+      respond_to do |wants|
+        # ... normal response processing
+      end
+    end
+
+    # If the request is fresh (i.e. it's not modified) then you don't need to do
+    # anything. The default render checks for this using the parameters
+    # used in the previous call to stale? and will automatically send a
+    # :not_modified.  So that's it, you're done.
+end
+-----------------------------------------------------
+
+If you don&#8217;t have any special response processing and are using the default
+rendering mechanism (i.e. you&#8217;re not using respond_to or calling render
+yourself) then you&#8217;ve got an easy helper in fresh_when:
+
+[source, ruby]
+-----------------------------------------------------
+class ProductsController &lt; ApplicationController
+
+  # This will automatically send back a :not_modified if the request is fresh,
+  # and will render the default template (product.*) if it's stale.
+
+  def show
+    @product = Product.find(params[:id])
+    fresh_when :last_modified =&gt; @product.published_at.utc, :etag =&gt; @article
+  end
+end
+-----------------------------------------------------
+
 == Advanced Caching
 
 Along with the built-in mechanisms outlined above, a number of excellent</diff>
      <filename>railties/doc/guides/source/caching_with_rails.txt</filename>
    </modified>
    <modified>
      <diff>@@ -99,7 +99,7 @@ Using generators will save you a large amount of time by writing *boilerplate co
 
 Let's make our own controller with the controller generator. But what command should we use? Let's ask the generator:
 
-NOTE: All Rails console utilities have help text. For commands that require a lot of input to run correctly, you can just try the command without any parameters (like `rails` or `./script/generate`). For others, you can try adding `--help` or `-h` to the end, as in `./script/server --help`.
+NOTE: All Rails console utilities have help text. For commands that require a lot of input to run correctly, you can try the command without any parameters (like `rails` or `./script/generate`). For others, you can try adding `--help` or `-h` to the end, as in `./script/server --help`.
 
 [source,shell]
 ------------------------------------------------------
@@ -143,5 +143,111 @@ $ ./script/generate controller Greeting hello
      create  app/views/greetings/hello.html.erb
 ------------------------------------------------------
 
-Look there! Now what all did this generate? It looks like it made sure a bunch of directories were in our application, and created a controller file, a functional test file, a helper for the view, and a view file. All from one command!
+Look there! Now what all did this generate? It looks like it made sure a bunch of directories were in our application, and created a controller file, a functional test file, a helper for the view, and a view file.
 
+Let's check out the controller and modify it a little (in `app/controllers/greeting_controller.rb`):
+
+[source,ruby]
+------------------------------------------------------
+class GreetingController &lt; ApplicationController
+  def hello
+    @message = &quot;Hello, how are you today? I am exuberant!&quot;
+  end
+
+end
+------------------------------------------------------
+
+Then the view, to display our nice message (in `app/views/greeting/hello.html.erb`):
+
+[source,html]
+------------------------------------------------------
+&lt;h1&gt;A Greeting for You!&lt;/h1&gt;
+&lt;p&gt;&lt;%= @message %&gt;&lt;/p&gt;
+------------------------------------------------------
+
+Deal. Go check it out in your browser. Fire up your server. Remember? `./script/server` at the root of your Rails application should do it.
+
+[source,shell]
+------------------------------------------------------
+$ ./script/server
+=&gt; Booting WEBrick...
+------------------------------------------------------
+
+The URL will be `http://localhost:3000/greetings/hello`. I'll wait for you to be suitably impressed.
+
+NOTE: With a normal, plain-old Rails application, your URLs will generally follow the pattern of http://(host)/(controller)/(action), and a URL like http://(host)/(controller) will hit the *index* action of that controller.
+
+&quot;What about data, though?&quot;, you ask over a cup of coffee. Rails comes with a generator for data models too. Can you guess its generator name?
+
+[source,shell]
+------------------------------------------------------
+$ ./script/generate model
+Usage: ./script/generate model ModelName [field:type, field:type]
+
+...
+
+Examples:
+    `./script/generate model account`
+
+        creates an Account model, test, fixture, and migration:
+            Model:      app/models/account.rb
+            Test:       test/unit/account_test.rb
+            Fixtures:   test/fixtures/accounts.yml
+            Migration:  db/migrate/XXX_add_accounts.rb
+
+    `./script/generate model post title:string body:text published:boolean`
+
+        creates a Post model with a string title, text body, and published flag.
+------------------------------------------------------
+
+Let's set up a simple model called &quot;HighScore&quot; that will keep track of our highest score on video games we play. Then we'll wire up our controller and view to modify and list our scores.
+
+[source,shell]
+------------------------------------------------------
+$ ./script/generate model HighScore id:integer game:string score:integer
+      exists  app/models/
+      exists  test/unit/
+      exists  test/fixtures/
+      create  app/models/high_score.rb
+      create  test/unit/high_score_test.rb
+      create  test/fixtures/high_scores.yml
+      create  db/migrate
+      create  db/migrate/20081126032945_create_high_scores.rb
+------------------------------------------------------
+
+Taking it from the top, we have the *models* directory, where all of your data models live. *test/unit*, where all the unit tests live (gasp! -- unit tests!), fixtures for those tests, a test, the *migrate* directory, where the database-modifying migrations live, and a migration to create the `high_scores` table with the right fields.
+
+The migration requires that we *migrate*, that is, run some Ruby code (living in that `20081126032945_create_high_scores.rb`) to modify the schema of our database. Which database? The sqlite3 database that Rails will create for you when we run the `rake db:migrate` command. We'll talk more about Rake in-depth in a little while.
+
+[source,shell]
+------------------------------------------------------
+$ rake db:migrate
+(in /home/commandsapp)
+==  CreateHighScores: migrating ===============================================
+-- create_table(:high_scores)
+   -&gt; 0.0070s
+==  CreateHighScores: migrated (0.0077s) ======================================
+------------------------------------------------------
+
+NOTE: Let's talk about unit tests. Unit tests are code that tests and makes assertions about code. In unit testing, we take a little part of code, say a method of a model, and test its inputs and outputs. Unit tests are your friend. The sooner you make peace with the fact that your quality of life will drastically increase when you unit test your code, the better. Seriously. We'll make one in a moment.
+
+Yo! Let's shove a small table into our greeting controller and view, listing our sweet scores.
+
+[source,ruby]
+------------------------------------------------------
+class GreetingController &lt; ApplicationController
+  def hello
+    if request.post?
+      score = HighScore.new(params[:high_score])
+      if score.save
+        flash[:notice] = &quot;New score posted!&quot;
+      end
+    end
+    
+    @scores = HighScore.find(:all)
+  end
+
+end
+------------------------------------------------------
+
+XXX: Go with scaffolding instead, modifying greeting controller for high scores seems dumb.</diff>
      <filename>railties/doc/guides/source/command_line.txt</filename>
    </modified>
    <modified>
      <diff>@@ -16,210 +16,179 @@ after-initializer
 
 == Using a Preinitializer
 
+== Initialization Process Settings
+
 == Configuring Rails Components
 
 === Configuring Active Record
 
++ActiveRecord::Base+ includej a variety of configuration options:
+
++logger+ accepts a logger conforming to the interface of Log4r or the default Ruby 1.8+ Logger class, which is then passed on to any new database connections made. You can retrieve this logger by calling +logger+ on either an ActiveRecord model class or an ActiveRecord model instance. Set to nil to disable logging.
+
++primary_key_prefix_type+ lets you adjust the naming for primary key columns. By default, Rails assumes that primary key columns are named +id+ (and this configuration option doesn't need to be set.) There are two other choices:
+
+* +:table_name+ would make the primary key for the Customer class +customerid+
+* +:table_name_with_underscore+ would make the primary key for the Customer class +customer_id+
+
++table_name_prefix+ lets you set a global string to be prepended to table names. If you set this to +northwest_+, then the Customer class will look for +northwest_customers+ as its table. The default is an empty string.
+
++table_name_suffix+ lets you set a global string to be appended to table names. If you set this to +_northwest+, then the Customer class will look for +customers_northwest+ as its table. The default is an empty string.
+
++pluralize_table_names+ specifies whether Rails will look for singular or plural table names in the database. If set to +true+ (the default), then the Customer class will use the +customers+ table. If set to +false+, then the Customers class will use the +customer+ table.
+
++colorize_logging+ (true by default) specifies whether or not to use ANSI color codes when logging information from ActiveRecord.
+
++default_timezone+ determines whether to use +Time.local+ (if set to +:local+) or +Time.utc+ (if set to +:utc+) when pulling dates and times from the database. The default is +:local+.
+
++schema_format+ controls the format for dumping the database schema to a file. The options are +:ruby+ (the default) for a database-independent version that depends on migrations, or +:sql+ for a set of (potentially database-dependent) SQL statements.
+
++timestamped_migrations+ controls whether migrations are numbered with serial integers or with timestamps. The default is +true+, to use timestamps, which are preferred if there are multiple developers working on the same application.
+
++lock_optimistically+ controls whether ActiveRecord will use optimistic locking. By default this is +true+.
+
+The MySQL adapter adds one additional configuration option:
+
++ActiveRecord::ConnectionAdapters::MysqlAdapter.emulate_booleans+ controls whether ActiveRecord will consider all +tinyint(1)+ columns in a MySQL database to be booleans. By default this is +true+.
+
+The schema dumper adds one additional configuration option:
+
++ActiveRecord::SchemaDumper.ignore_tables+ accepts an array of tables that should _not_ be included in any generated schema file. This setting is ignored unless +ActiveRecord::Base.schema_format == :ruby+.
+
 === Configuring Action Controller
 
-=== Configuring Action View
+ActionController::Base includes a number of configuration settings:
 
-=== Configuring Action Mailer
++asset_host+ provides a string that is prepended to all of the URL-generating helpers in +AssetHelper+. This is designed to allow moving all javascript, CSS, and image files to a separate asset host.
 
-=== Configuring Active Resource
++consider_all_requests_local+ is generally set to +true+ during development and +false+ during production; if it is set to +true+, then any error will cause detailed debugging information to be dumped in the HTTP response. For finer-grained control, set this to +false+ and implement +local_request?+ to specify which requests should provide debugging information on errors.
 
-=== Configuring Active Support
++allow_concurrency+ should be set to +true+ to allow concurrent (threadsafe) action processing. Set to +false+ by default.
 
-== Using Initializers
- organization, controlling load order
++param_parsers+ provides an array of handlers that can extract information from incoming HTTP requests and add it to the +params+ hash. By default, parsers for multipart forms, URL-encoded forms, XML, and JSON are active.
 
-== Using an After-Initializer
++default_charset+ specifies the default character set for all renders. The default is &quot;utf-8&quot;.
 
-== Changelog ==
++logger+ accepts a logger conforming to the interface of Log4r or the default Ruby 1.8+ Logger class, which is then used to log information from Action Controller. Set to nil to disable logging.
 
-http://rails.lighthouseapp.com/projects/16213-rails-guides/tickets/28[Lighthouse ticket]
++resource_action_separator+ gives the token to be used between resources and actions when building or interpreting RESTful URLs. By default, this is &quot;/&quot;.
 
-* November 5, 2008: Rough outline by link:../authors.html#mgunderloy[Mike Gunderloy]
++resource_path_names+ is a hash of default names for several RESTful actions. By default, the new action is named +new+ and the edit action is named +edit+.
+
++request_forgery_protection_token+ sets the token parameter name for RequestForgery. Calling +protect_from_forgery+ sets it to +:authenticity_token+ by default.
 
++optimise_named_routes+ turns on some optimizations in generating the routing table. It is set to +true+ by default.
 
-actionmailer/lib/action_mailer/base.rb
-257:    cattr_accessor :logger
-267:    cattr_accessor :smtp_settings
-273:    cattr_accessor :sendmail_settings
-276:    cattr_accessor :raise_delivery_errors
-282:    cattr_accessor :perform_deliveries
-285:    cattr_accessor :deliveries
-288:    cattr_accessor :default_charset
-291:    cattr_accessor :default_content_type
-294:    cattr_accessor :default_mime_version
-297:    cattr_accessor :default_implicit_parts_order
-299:    cattr_reader :protected_instance_variables
-
-actionmailer/Rakefile
-36:  rdoc.options &lt;&lt; '--line-numbers' &lt;&lt; '--inline-source' &lt;&lt; '-A cattr_accessor=object'
-
-actionpack/lib/action_controller/base.rb
-263:    cattr_reader :protected_instance_variables
-273:    cattr_accessor :asset_host
-279:    cattr_accessor :consider_all_requests_local
-285:    cattr_accessor :allow_concurrency
-317:    cattr_accessor :param_parsers
-321:    cattr_accessor :default_charset
-325:    cattr_accessor :logger
-329:    cattr_accessor :resource_action_separator
-333:    cattr_accessor :resources_path_names
-337:    cattr_accessor :request_forgery_protection_token
-341:    cattr_accessor :optimise_named_routes
-351:    cattr_accessor :use_accept_header
-361:    cattr_accessor :relative_url_root
-
-actionpack/lib/action_controller/caching/pages.rb
-55:          cattr_accessor :page_cache_directory
-58:          cattr_accessor :page_cache_extension
-
-actionpack/lib/action_controller/caching.rb
-37:        cattr_reader :cache_store
-48:        cattr_accessor :perform_caching
-
-actionpack/lib/action_controller/dispatcher.rb
-98:    cattr_accessor :error_file_path
-
-actionpack/lib/action_controller/mime_type.rb
-24:    cattr_reader :html_types, :unverifiable_types
++use_accept_header+ sets the rules for determining the response format. If this is set to +true+ (the default) then +respond_to+ and +Request#format+ will take the Accept header into account. If it is set to false then the request format will be determined solely by examining +params[:format]+. If there is no +format+ parameter, then the response format will be either HTML or Javascript depending on whether the request is an AJAX request.
 
-actionpack/lib/action_controller/rescue.rb
-36:      base.cattr_accessor :rescue_responses
-40:      base.cattr_accessor :rescue_templates
++allow_forgery_protection+ enables or disables CSRF protection. By default this is +false+ in test mode and +true+ in all other modes.
 
-actionpack/lib/action_controller/session/active_record_store.rb
-60:        cattr_accessor :data_column_name
-170:        cattr_accessor :connection
-173:        cattr_accessor :table_name
-177:        cattr_accessor :session_id_column
-181:        cattr_accessor :data_column
-282:      cattr_accessor :session_class
-
-actionpack/lib/action_controller/vendor/html-scanner/html/sanitizer.rb
-44:    cattr_accessor :included_tags, :instance_writer =&gt; false
-
-actionpack/lib/action_view/base.rb
-189:    cattr_accessor :debug_rjs
-193:    cattr_accessor :warn_cache_misses
-
-actionpack/lib/action_view/helpers/active_record_helper.rb
-7:    cattr_accessor :field_error_proc
-
-actionpack/lib/action_view/helpers/form_helper.rb
-805:    cattr_accessor :default_form_builder
-
-actionpack/lib/action_view/template_handlers/erb.rb
-47:      cattr_accessor :erb_trim_mode
++relative_url_root+ can be used to tell Rails that you are deploying to a subdirectory. The default is +ENV['RAILS_RELATIVE_URL_ROOT']+.
 
-actionpack/test/active_record_unit.rb
-5:  cattr_accessor :able_to_connect
-6:  cattr_accessor :connected
+The caching code adds two additional settings:
 
-actionpack/test/controller/filters_test.rb
-286:    cattr_accessor :execution_log
++ActionController::Caching::Pages.page_cache_directory+ sets the directory where Rails will create cached pages for your web server. The default is +Rails.public_path+ (which is usually set to +RAILS_ROOT + &quot;/public&quot;+).
 
-actionpack/test/template/form_options_helper_test.rb
-3:TZInfo::Timezone.cattr_reader :loaded_zones
++ActionController::Caching::Pages.page_cache_extension+ sets the extension to be used when generating pages for the cache (this is ignored if the incoming request already has an extension). The default is +.html+.
 
-activemodel/lib/active_model/errors.rb
-28:    cattr_accessor :default_error_messages
+The dispatcher includes one setting:
 
-activemodel/Rakefile
-19:  rdoc.options &lt;&lt; '--line-numbers' &lt;&lt; '--inline-source' &lt;&lt; '-A cattr_accessor=object'
++ActionController::Dispatcher.error_file_path+ gives the path where Rails will look for error files such as +404.html+. The default is +Rails.public_path+.
 
-activerecord/lib/active_record/attribute_methods.rb
-9:      base.cattr_accessor :attribute_types_cached_by_default, :instance_writer =&gt; false
-11:      base.cattr_accessor :time_zone_aware_attributes, :instance_writer =&gt; false
+The Active Record session store can also be configured:
 
-activerecord/lib/active_record/base.rb
-394:    cattr_accessor :logger, :instance_writer =&gt; false
-443:    cattr_accessor :configurations, :instance_writer =&gt; false
-450:    cattr_accessor :primary_key_prefix_type, :instance_writer =&gt; false
-456:    cattr_accessor :table_name_prefix, :instance_writer =&gt; false
-461:    cattr_accessor :table_name_suffix, :instance_writer =&gt; false
-467:    cattr_accessor :pluralize_table_names, :instance_writer =&gt; false
-473:    cattr_accessor :colorize_logging, :instance_writer =&gt; false
-478:    cattr_accessor :default_timezone, :instance_writer =&gt; false
-487:    cattr_accessor :schema_format , :instance_writer =&gt; false
-491:    cattr_accessor :timestamped_migrations , :instance_writer =&gt; false
++CGI::Session::ActiveRecordStore::Session.data_column_name+ sets the name of the column to use to store session data. By default it is 'data'
 
-activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb
-11:    cattr_accessor :connection_handler, :instance_writer =&gt; false
+=== Configuring Action View
+
+There are only a few configuration options for Action View, starting with four on +ActionView::Base+:
+
++debug_rjs+ specifies whether RJS responses should be wrapped in a try/catch block that alert()s the caught exception (and then re-raises it). The default is +false+.
+
++warn_cache_misses+ tells Rails to display a warning whenever an action results in a cache miss on your view paths. The default is +false+.
+
++field_error_proc+ provides an HTML generator for displaying errors that come from Active Record. The default is +Proc.new{ |html_tag, instance| &quot;&lt;div class=\&quot;fieldWithErrors\&quot;&gt;#{html_tag}&lt;/div&gt;&quot; }+
+
++default_form_builder+ tells Rails which form builder to use by default. The default is +ActionView::Helpers::FormBuilder+.
+
+The ERB template handler supplies one additional option:
+
++ActionView::TemplateHandlers::ERB.erb_trim_mode+ gives the trim mode to be used by ERB. It defaults to +'-'+. See the link:http://www.ruby-doc.org/stdlib/libdoc/erb/rdoc/[ERB documentation] for more information.
+
+=== Configuring Action Mailer
+
+There are a number of settings available on +ActionMailer::Base+:
+
++template_root+ gives the root folder for Action Mailer templates.
+
++logger+ accepts a logger conforming to the interface of Log4r or the default Ruby 1.8+ Logger class, which is then used to log information from Action Mailer. Set to nil to disable logging.
+
++smtp_settings+ allows detailed configuration for the +:smtp+ delivery method. It accepts a hash of options, which can include any of these options:
 
-activerecord/lib/active_record/connection_adapters/mysql_adapter.rb
-166:      cattr_accessor :emulate_booleans
+* &lt;tt&gt;:address&lt;/tt&gt; - Allows you to use a remote mail server. Just change it from its default &quot;localhost&quot; setting.
+* &lt;tt&gt;:port&lt;/tt&gt; - On the off chance that your mail server doesn't run on port 25, you can change it.
+* &lt;tt&gt;:domain&lt;/tt&gt; - If you need to specify a HELO domain, you can do it here.
+* &lt;tt&gt;:user_name&lt;/tt&gt; - If your mail server requires authentication, set the username in this setting.
+* &lt;tt&gt;:password&lt;/tt&gt; - If your mail server requires authentication, set the password in this setting.
+* &lt;tt&gt;:authentication&lt;/tt&gt; - If your mail server requires authentication, you need to specify the authentication type here. This is a symbol and one of &lt;tt&gt;:plain&lt;/tt&gt;, &lt;tt&gt;:login&lt;/tt&gt;, &lt;tt&gt;:cram_md5&lt;/tt&gt;.
 
-activerecord/lib/active_record/fixtures.rb
-498:  cattr_accessor :all_loaded_fixtures
++sendmail_settings+ allows detailed configuration for the +sendmail+ delivery method. It accepts a hash of options, which can include any of these options:
 
-activerecord/lib/active_record/locking/optimistic.rb
-38:        base.cattr_accessor :lock_optimistically, :instance_writer =&gt; false
+* &lt;tt&gt;:location&lt;/tt&gt; - The location of the sendmail executable. Defaults to &lt;tt&gt;/usr/sbin/sendmail&lt;/tt&gt;.
+* &lt;tt&gt;:arguments&lt;/tt&gt; - The command line arguments. Defaults to &lt;tt&gt;-i -t&lt;/tt&gt;.
 
-activerecord/lib/active_record/migration.rb
-259:    cattr_accessor :verbose
++raise_delivery_errors+ specifies whether to raise an error if email delivery cannot be completed. It defaults to +true+.
 
-activerecord/lib/active_record/schema_dumper.rb
-13:    cattr_accessor :ignore_tables 
++delivery_method+ defines the delivery method. The allowed values are &lt;tt&gt;:smtp&lt;/tt&gt; (default), &lt;tt&gt;:sendmail&lt;/tt&gt;, and &lt;tt&gt;:test&lt;/tt&gt;.
 
-activerecord/lib/active_record/serializers/json_serializer.rb
-4:      base.cattr_accessor :include_root_in_json, :instance_writer =&gt; false
++perform_deliveries+ specifies whether mail will actually be delivered. By default this is +true+; it can be convenient to set it to +false+ for testing.
 
-activerecord/Rakefile
-142:  rdoc.options &lt;&lt; '--line-numbers' &lt;&lt; '--inline-source' &lt;&lt; '-A cattr_accessor=object'
++default_charset+ tells Action Mailer which character set to use for the body and for encoding the subject. It defaults to +utf-8+.
 
-activerecord/test/cases/lifecycle_test.rb
-61:  cattr_reader :last_inherited
++default_content_type+ specifies the default content type used for the main part of the message. It defaults to &quot;text/plain&quot;
 
-activerecord/test/cases/mixin_test.rb
-9:  cattr_accessor :forced_now_time
++default_mime_version+ is the default MIME version for the message. It defaults to +1.0+.
 
-activeresource/lib/active_resource/base.rb
-206:    cattr_accessor :logger
++default_implicit_parts_order+ - 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
+&lt;tt&gt;[&quot;text/html&quot;, &quot;text/enriched&quot;, &quot;text/plain&quot;]&lt;/tt&gt;. Items that appear first in the array have higher priority in the mail client
+and appear last in the mime encoded message.
 
-activeresource/Rakefile
-43:  rdoc.options &lt;&lt; '--line-numbers' &lt;&lt; '--inline-source' &lt;&lt; '-A cattr_accessor=object'
+=== Configuring Active Resource
+
+There is a single configuration setting available on +ActiveResource::Base+:
+
++logger+ accepts a logger conforming to the interface of Log4r or the default Ruby 1.8+ Logger class, which is then used to log information from Active Resource. Set to nil to disable logging.
+
+=== Configuring Active Support
+
+There are a few configuration options available in Active Support:
+
++ActiveSupport::BufferedLogger.silencer+ is set to +false+ to disable the ability to silence logging in a block. The default is +true+.
 
-activesupport/lib/active_support/buffered_logger.rb
-17:    cattr_accessor :silencer
++ActiveSupport::Cache::Store.logger+ specifies the logger to use within cache store operations.
 
-activesupport/lib/active_support/cache.rb
-81:      cattr_accessor :logger
++ActiveSupport::Logger.silencer+ is set to +false+ to disable the ability to silence logging in a block. The default is +true+.
 
-activesupport/lib/active_support/core_ext/class/attribute_accessors.rb
-5:#    cattr_accessor :hair_colors
-10:  def cattr_reader(*syms)
-29:  def cattr_writer(*syms)
-50:  def cattr_accessor(*syms)
-51:    cattr_reader(*syms)
-52:    cattr_writer(*syms)
+=== Configuring Active Model
 
-activesupport/lib/active_support/core_ext/logger.rb
-34:  cattr_accessor :silencer
+Active Model currently has a single configuration setting:
 
-activesupport/test/core_ext/class/attribute_accessor_test.rb
-6:      cattr_accessor :foo
-7:      cattr_accessor :bar, :instance_writer =&gt; false
++ActiveModel::Errors.default_error_messages is an array containing all of the validation error messages.
 
-activesupport/test/core_ext/module/synchronization_test.rb
-6:    @target.cattr_accessor :mutex, :instance_writer =&gt; false
+== Using Initializers
+ organization, controlling load order
 
-railties/doc/guides/html/creating_plugins.html
-786:      cattr_accessor &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;yaffle_text_field&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;yaffle_date_field
-860:      cattr_accessor &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;yaffle_text_field&lt;span style=&quot;color: #990000&quot;&gt;,&lt;/span&gt; &lt;span style=&quot;color: #990000&quot;&gt;:&lt;/span&gt;yaffle_date_field
+== Using an After-Initializer
 
-railties/lib/rails_generator/base.rb
-93:      cattr_accessor :logger
+== Rails Environment Settings
 
-railties/Rakefile
-265:  rdoc.options &lt;&lt; '--line-numbers' &lt;&lt; '--inline-source' &lt;&lt; '--accessor' &lt;&lt; 'cattr_accessor=object'
+ENV
 
-railties/test/rails_info_controller_test.rb
-12:    cattr_accessor :local_request
+== Changelog ==
 
-Rakefile
-32:  rdoc.options &lt;&lt; '-A cattr_accessor=object'
+http://rails.lighthouseapp.com/projects/16213-rails-guides/tickets/28[Lighthouse ticket]
+
+* November 5, 2008: Rough outline by link:../authors.html#mgunderloy[Mike Gunderloy]
 
+need to look for def self. ???</diff>
      <filename>railties/doc/guides/source/configuring.txt</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
-== Add an `acts_as_yaffle` method to Active Record ==
+== Add an 'acts_as' method to Active Record ==
 
 A common pattern in plugins is to add a method called 'acts_as_something' to models.  In this case, you want to write a method called 'acts_as_yaffle' that adds a 'squawk' method to your models.
 </diff>
      <filename>railties/doc/guides/source/creating_plugins/acts_as_yaffle.txt</filename>
    </modified>
    <modified>
      <diff>@@ -1,46 +1,104 @@
 == Appendix ==
 
+If you prefer to use RSpec instead of Test::Unit, you may be interested in the http://github.com/pat-maddox/rspec-plugin-generator/tree/master[RSpec Plugin Generator].
+
 === References ===
 
  * http://nubyonrails.com/articles/the-complete-guide-to-rails-plugins-part-i
  * http://nubyonrails.com/articles/2006/05/09/the-complete-guide-to-rails-plugins-part-ii
  * http://github.com/technoweenie/attachment_fu/tree/master
  * http://daddy.platte.name/2007/05/rails-plugins-keep-initrb-thin.html
+ * http://www.mbleigh.com/2008/6/11/gemplugins-a-brief-introduction-to-the-future-of-rails-plugins
+ * http://weblog.jamisbuck.org/2006/10/26/monkey-patching-rails-extending-routes-2.
+
+=== Contents of 'lib/yaffle.rb' ===
+
+*vendor/plugins/yaffle/lib/yaffle.rb:*
+
+[source, ruby]
+----------------------------------------------
+require &quot;yaffle/core_ext&quot;
+require &quot;yaffle/acts_as_yaffle&quot;
+require &quot;yaffle/commands&quot;
+require &quot;yaffle/routing&quot;
+
+%w{ models controllers helpers }.each do |dir|
+  path = File.join(File.dirname(__FILE__), 'app', dir)
+  $LOAD_PATH &lt;&lt; path
+  ActiveSupport::Dependencies.load_paths &lt;&lt; path
+  ActiveSupport::Dependencies.load_once_paths.delete(path)
+end
+
+# optionally:
+# Dir.glob(File.join(File.dirname(__FILE__), &quot;db&quot;, &quot;migrate&quot;, &quot;*&quot;)).each do |file|
+#   require file
+# end
+
+----------------------------------------------
+
 
 === Final plugin directory structure ===
 
 The final plugin should have a directory structure that looks something like this:
 
 ------------------------------------------------
-  |-- MIT-LICENSE
-  |-- README
-  |-- Rakefile
-  |-- generators
-  |   `-- yaffle
-  |       |-- USAGE
-  |       |-- templates
-  |       |   `-- definition.txt
-  |       `-- yaffle_generator.rb
-  |-- init.rb
-  |-- install.rb
-  |-- lib
-  |   |-- acts_as_yaffle.rb
-  |   |-- commands.rb
-  |   |-- core_ext.rb
-  |   |-- routing.rb
-  |   `-- view_helpers.rb
-  |-- tasks
-  |   `-- yaffle_tasks.rake
-  |-- test
-  |   |-- acts_as_yaffle_test.rb
-  |   |-- core_ext_test.rb
-  |   |-- database.yml
-  |   |-- debug.log
-  |   |-- routing_test.rb
-  |   |-- schema.rb
-  |   |-- test_helper.rb
-  |   `-- view_helpers_test.rb
-  |-- uninstall.rb
-  `-- yaffle_plugin.sqlite3.db
+|-- MIT-LICENSE
+|-- README
+|-- Rakefile
+|-- generators
+|   |-- yaffle_definition
+|   |   |-- USAGE
+|   |   |-- templates
+|   |   |   `-- definition.txt
+|   |   `-- yaffle_definition_generator.rb
+|   |-- yaffle_migration
+|   |   |-- USAGE
+|   |   |-- templates
+|   |   `-- yaffle_migration_generator.rb
+|   `-- yaffle_route
+|       |-- USAGE
+|       |-- templates
+|       `-- yaffle_route_generator.rb
+|-- install.rb
+|-- lib
+|   |-- app
+|   |   |-- controllers
+|   |   |   `-- woodpeckers_controller.rb
+|   |   |-- helpers
+|   |   |   `-- woodpeckers_helper.rb
+|   |   `-- models
+|   |       `-- woodpecker.rb
+|   |-- db
+|   |   `-- migrate
+|   |       `-- 20081116181115_create_birdhouses.rb
+|   |-- yaffle
+|   |   |-- acts_as_yaffle.rb
+|   |   |-- commands.rb
+|   |   |-- core_ext.rb
+|   |   `-- routing.rb
+|   `-- yaffle.rb
+|-- pkg
+|   `-- yaffle-0.0.1.gem
+|-- rails
+|   `-- init.rb
+|-- tasks
+|   `-- yaffle_tasks.rake
+|-- test
+|   |-- acts_as_yaffle_test.rb
+|   |-- core_ext_test.rb
+|   |-- database.yml
+|   |-- debug.log
+|   |-- definition_generator_test.rb
+|   |-- migration_generator_test.rb
+|   |-- route_generator_test.rb
+|   |-- routes_test.rb
+|   |-- schema.rb
+|   |-- test_helper.rb
+|   |-- woodpecker_test.rb
+|   |-- woodpeckers_controller_test.rb
+|   |-- wookpeckers_helper_test.rb
+|   |-- yaffle_plugin.sqlite3.db
+|   `-- yaffle_test.rb
+`-- uninstall.rb
 ------------------------------------------------
 </diff>
      <filename>railties/doc/guides/source/creating_plugins/appendix.txt</filename>
    </modified>
    <modified>
      <diff>@@ -1,10 +1,10 @@
-== Add a controller ==
+== Controllers ==
 
 This section describes how to add a controller named 'woodpeckers' to your plugin that will behave the same as a controller in your main app.  This is very similar to adding a model.
 
 You can test your plugin's controller as you would test any other controller:
 
-*vendor/plugins/yaffle/yaffle/woodpeckers_controller_test.rb:*
+*vendor/plugins/yaffle/test/woodpeckers_controller_test.rb:*
 
 [source, ruby]
 ----------------------------------------------
@@ -19,6 +19,10 @@ class WoodpeckersControllerTest &lt; Test::Unit::TestCase
     @controller = WoodpeckersController.new
     @request = ActionController::TestRequest.new
     @response = ActionController::TestResponse.new
+    
+    ActionController::Routing::Routes.draw do |map|
+      map.resources :woodpeckers
+    end    
   end
 
   def test_index</diff>
      <filename>railties/doc/guides/source/creating_plugins/controllers.txt</filename>
    </modified>
    <modified>
      <diff>@@ -1,11 +1,6 @@
 == Extending core classes ==
 
-This section will explain how to add a method to String that will be available anywhere in your rails app by:
-
- * Writing tests for the desired behavior
- * Creating and requiring the correct files
-
-=== Creating the test ===
+This section will explain how to add a method to String that will be available anywhere in your rails app.
 
 In this example you will add a method to String named `to_squawk`.  To begin, create a new test file with a few assertions:
 
@@ -40,26 +35,6 @@ NoMethodError: undefined method `to_squawk' for &quot;Hello World&quot;:String
 
 Great - now you are ready to start development.
 
-=== Organize your files ===
-
-A common pattern in rails plugins is to set up the file structure like this:
-
---------------------------------------------------------
-|-- lib
-|   |-- yaffle
-|   |   `-- core_ext.rb
-|   `-- yaffle.rb
---------------------------------------------------------
-
-The first thing we need to to is to require our 'lib/yaffle.rb' file from 'rails/init.rb':
-
-*vendor/plugins/yaffle/rails/init.rb*
-
-[source, ruby]
---------------------------------------------------------
-require 'yaffle'
---------------------------------------------------------
-
 Then in 'lib/yaffle.rb' require 'lib/core_ext.rb':
 
 *vendor/plugins/yaffle/lib/yaffle.rb*
@@ -92,13 +67,13 @@ $ ./script/console
 
 === Working with init.rb ===
 
-When rails loads plugins it looks for the file named init.rb.  However, when the plugin is initialized, 'init.rb' is invoked via `eval` (not `require`) so it has slightly different behavior.
+When rails loads plugins it looks for the file named 'init.rb' or 'rails/init.rb'.  However, when the plugin is initialized, 'init.rb' is invoked via `eval` (not `require`) so it has slightly different behavior.
 
 Under certain circumstances if you reopen classes or modules in 'init.rb' you may inadvertently create a new class, rather than reopening an existing class.  A better alternative is to reopen the class in a different file, and require that file from `init.rb`, as shown above.
 
 If you must reopen a class in `init.rb` you can use `module_eval` or `class_eval` to avoid any issues:
 
-*vendor/plugins/yaffle/init.rb*
+*vendor/plugins/yaffle/rails/init.rb*
 
 [source, ruby]
 ---------------------------------------------------
@@ -111,7 +86,7 @@ end
 
 Another way is to explicitly define the top-level module space for all modules and classes, like `::Hash`:
 
-*vendor/plugins/yaffle/init.rb*
+*vendor/plugins/yaffle/rails/init.rb*
 
 [source, ruby]
 ---------------------------------------------------</diff>
      <filename>railties/doc/guides/source/creating_plugins/core_ext.txt</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
-== Add a helper ==
+== Helpers ==
 
 This section describes how to add a helper named 'WoodpeckersHelper' to your plugin that will behave the same as a helper in your main app.  This is very similar to adding a model and a controller.
 
@@ -30,8 +30,6 @@ This is just a simple test to make sure the helper is being loaded correctly.  A
   ActiveSupport::Dependencies.load_paths &lt;&lt; path
   ActiveSupport::Dependencies.load_once_paths.delete(path)
 end
-
-ActionView::Base.send :include, WoodpeckersHelper
 ----------------------------------------------
 
 </diff>
      <filename>railties/doc/guides/source/creating_plugins/helpers.txt</filename>
    </modified>
    <modified>
      <diff>@@ -29,24 +29,32 @@ This guide describes how to build a test-driven plugin that will:
 For the purpose of this guide pretend for a moment that you are an avid bird watcher.  Your favorite bird is the Yaffle, and you want to create a plugin that allows other developers to share in the Yaffle goodness.  First, you need to get setup for development.
 
 
-include::test_setup.txt[]
+include::setup.txt[]
+
+include::tests.txt[]
 
 include::core_ext.txt[]
 
 include::acts_as_yaffle.txt[]
 
-include::migration_generator.txt[]
-
-include::generator_method.txt[]
-
 include::models.txt[]
 
 include::controllers.txt[]
 
 include::helpers.txt[]
 
-include::custom_route.txt[]
+include::routes.txt[]
+
+include::generators.txt[]
+
+include::generator_commands.txt[]
+
+include::migrations.txt[]
+
+include::tasks.txt[]
+
+include::gems.txt[]
 
-include::odds_and_ends.txt[]
+include::rdoc.txt[]
 
 include::appendix.txt[]</diff>
      <filename>railties/doc/guides/source/creating_plugins/index.txt</filename>
    </modified>
    <modified>
      <diff>@@ -1,4 +1,4 @@
-== Add a model ==
+== Models ==
 
 This section describes how to add a model named 'Woodpecker' to your plugin that will behave the same as a model in your main app.  When storing models, controllers, views and helpers in your plugin, it's customary to keep them in directories that match the rails directories.  For this example, create a file structure like this:
 
@@ -66,11 +66,9 @@ Finally, add the following to your plugin's 'schema.rb':
 
 [source, ruby]
 ----------------------------------------------
-ActiveRecord::Schema.define(:version =&gt; 0) do
-  create_table :woodpeckers, :force =&gt; true do |t|
-    t.string :name
-  end
+create_table :woodpeckers, :force =&gt; true do |t|
+  t.string :name
 end
 ----------------------------------------------
 
-Now your test should be passing, and you should be able to use the Woodpecker model from within your rails app, and any changes made to it are reflected immediately when running in development mode.
\ No newline at end of file
+Now your test should be passing, and you should be able to use the Woodpecker model from within your rails app, and any changes made to it are reflected immediately when running in development mode.</diff>
      <filename>railties/doc/guides/source/creating_plugins/models.txt</filename>
    </modified>
    <modified>
      <diff>@@ -13,6 +13,8 @@ This guide covers the +find+ method defined in +ActiveRecord::Base+, as well as
 
 If you're used to using raw SQL to find database records, you'll find that there are generally better ways to carry out the same operations in Rails. Active Record insulates you from the need to use SQL in most cases.
 
+The SQL in your log may have some quoting, and that quoting depends on the backend (MySQL, for example, puts backticks around field and table names). Attempting to copy the raw SQL contained within this guide may not work in your database system. Please consult the database systems manual before attempting to execute any SQL.
+
 == The Sample Models
 
 This guide demonstrates finding using the following models:
@@ -52,16 +54,16 @@ Active Record will perform queries on the database for you and is compatible wit
 
 [source, sql]
 -------------------------------------------------------
-SELECT * FROM +clients+ WHERE (+clients+.+id+ = 1) 
+SELECT * FROM clients WHERE (clients.id = 1) 
 -------------------------------------------------------
 
-NOTE: Because this is a standard table created from a migration in Rail, the primary key is defaulted to 'id'. If you have specified a different primary key in your migrations, this is what Rails will find on when you call the find method, not the id column.
+NOTE: Because this is a standard table created from a migration in Rails, the primary key is defaulted to 'id'. If you have specified a different primary key in your migrations, this is what Rails will find on when you call the find method, not the id column.
 
 If you wanted to find clients with id 1 or 2, you call +Client.find([1,2])+ or +Client.find(1,2)+ and then this will be executed as:
 
 [source, sql]
 -------------------------------------------------------
-SELECT * FROM +clients+ WHERE (+clients+.+id+ IN (1,2)) 
+SELECT * FROM clients WHERE (clients.id IN (1,2)) 
 -------------------------------------------------------
 
 -------------------------------------------------------
@@ -76,7 +78,7 @@ Note that if you pass in a list of numbers that the result will be returned as a
 
 NOTE: If +find(id)+ or +find([id1, id2])+ fails to find any records, it will raise a +RecordNotFound+ exception.
 
-If you wanted to find the first client you would simply type +Client.first+ and that would find the first client created in your clients table:
+If you wanted to find the first Client object you would simply type +Client.first+ and that would find the first client in your clients table:
 
 -------------------------------------------------------
 &gt;&gt; Client.first
@@ -84,7 +86,7 @@ If you wanted to find the first client you would simply type +Client.first+ and
   created_at: &quot;2008-09-28 15:38:50&quot;, updated_at: &quot;2008-09-28 15:38:50&quot;&gt;
 -------------------------------------------------------
 
-If you were running script/server you might see the following output:
+If you were reading your log file (the default is log/development.log) you may see something like this:
 
 [source,sql]
 -------------------------------------------------------
@@ -93,20 +95,29 @@ SELECT * FROM clients LIMIT 1
 
 Indicating the query that Rails has performed on your database. 
 
-To find the last client you would simply type +Client.find(:last)+ and that would find the last client created in your clients table:
+To find the last Client object you would simply type +Client.last+ and that would find the last client created in your clients table:
 
 -------------------------------------------------------
-&gt;&gt; Client.find(:last)
+&gt;&gt; Client.last
 =&gt; #&lt;Client id: 2, name: =&gt; &quot;Michael&quot;, locked: false, orders_count: 3, 
   created_at: &quot;2008-09-28 13:12:40&quot;, updated_at: &quot;2008-09-28 13:12:40&quot;&gt;
 -------------------------------------------------------
 
+If you were reading your log file (the default is log/development.log) you may see something like this:
+
+[source,sql]
+-------------------------------------------------------
+SELECT * FROM clients ORDER BY id DESC LIMIT 1
+-------------------------------------------------------
+
+NOTE: Please be aware that the syntax that Rails uses to find the first record in the table means that it may not be the actual first record. If you want the actual first record based on a field in your table (e.g. +created_at+) specify an order option in your find call. The last method call works differently: it finds the last record on your table based on the primary key column.
+
 [source,sql]
 -------------------------------------------------------
 SELECT * FROM clients ORDER BY clients.id DESC LIMIT 1
 -------------------------------------------------------
 
-To find all the clients you would simply type +Client.all+ and that would find all the clients in your clients table:
+To find all the Client objects you would simply type +Client.all+ and that would find all the clients in your clients table:
 
 -------------------------------------------------------
 &gt;&gt; Client.all
@@ -114,11 +125,11 @@ To find all the clients you would simply type +Client.all+ and that would find a
   created_at: &quot;2008-09-28 15:38:50&quot;, updated_at: &quot;2008-09-28 15:38:50&quot;&gt;, 
   #&lt;Client id: 2, name: =&gt; &quot;Michael&quot;, locked: false, orders_count: 3, 
   created_at: &quot;2008-09-28 13:12:40&quot;, updated_at: &quot;2008-09-28 13:12:40&quot;&gt;]
--------------------------------------------------------
+------------------------------------------------------- 
 
-As alternatives to calling +Client.first+, +Client.last+, and +Client.all+, you can use the class methods +Client.first+, +Client.last+, and +Client.all+ instead. +Client.first+, +Client.last+ and +Client.all+ just call their longer counterparts: +Client.find(:first)+, +Client.find(:last)+ and +Client.find(:all)+ respectively.
+You may see in Rails code that there are calls to methods such as +Client.find(:all)+, +Client.find(:first)+ and +Client.find(:last)+. These methods are just alternatives to +Client.all+, +Client.first+ and +Client.last+ respectively.
 
-Be aware that +Client.first+/+Client.find(:first)+ and +Client.last+/+Client.find(:last)+ will both return a single object, where as +Client.all+/+Client.find(:all)+ will return an array of Client objects, just as passing in an array of ids to find will do also.
+Be aware that +Client.first+/+Client.find(:first)+ and +Client.last+/+Client.find(:last)+ will both return a single object, where as +Client.all+/+Client.find(:all)+ will return an array of Client objects, just as passing in an array of ids to +find+ will do also.
 
 == Conditions
 
@@ -132,19 +143,20 @@ WARNING: Building your own conditions as pure strings can leave you vulnerable t
 
 === Array Conditions ===
 
-Now what if that number could vary, say as a parameter from somewhere, or perhaps from the user's level status somewhere? The find then becomes something like +Client.first(:conditions =&gt; [&quot;orders_count = ?&quot;, params[:orders]])+. Active Record will go through the first element in the conditions value and any additional elements will replace the question marks (?) in the first element. If you want to specify two conditions, you can do it like +Client.first(:conditions =&gt; [&quot;orders_count = ? AND locked = ?&quot;, params[:orders], false])+. In this example, the first question mark will be replaced with the value in params orders and the second will be replaced with true and this will find the first record in the table that has '2' as its value for the orders_count field and 'false' for its locked field.
+Now what if that number could vary, say as a parameter from somewhere, or perhaps from the user's level status somewhere? The find then becomes something like +Client.first(:conditions =&gt; [&quot;orders_count = ?&quot;, params[:orders]])+. Active Record will go through the first element in the conditions value and any additional elements will replace the question marks (?) in the first element. If you want to specify two conditions, you can do it like +Client.first(:conditions =&gt; [&quot;orders_count = ? AND locked = ?&quot;, params[:orders], false])+. In this example, the first question mark will be replaced with the value in +params[:orders]+ and the second will be replaced with +false+ and this will find the first record in the table that has '2' as its value for the +orders_count+ field and +false+ for its locked field.
 
 The reason for doing code like:
 
 [source, ruby]
 -------------------------------------------------------
-+Client.first(:conditions =&gt; [&quot;orders_count = ?&quot;, params[:orders]])+
+Client.first(:conditions =&gt; [&quot;orders_count = ?&quot;, params[:orders]])
 -------------------------------------------------------
 
 instead of:
 
+[source, ruby]
 -------------------------------------------------------
-+Client.first(:conditions =&gt; &quot;orders_count = #{params[:orders]}&quot;)+
+Client.first(:conditions =&gt; &quot;orders_count = #{params[:orders]}&quot;)
 -------------------------------------------------------
 
 is because of parameter safety. Putting the variable directly into the conditions string will pass the variable to the database *as-is*. This means that it will be an unescaped variable directly from a user who may have malicious intent. If you do this, you put your entire database at risk because once a user finds out he or she can exploit your database they can do just about anything to it. Never ever put your parameters directly inside the conditions string.
@@ -163,7 +175,7 @@ This would generate the proper query which is great for small ranges but not so
 
 [source, sql]
 -------------------------------------------------------
-SELECT * FROM +users+ WHERE (created_at IN 
+SELECT * FROM users WHERE (created_at IN 
   ('2007-12-31','2008-01-01','2008-01-02','2008-01-03','2008-01-04','2008-01-05',
   '2008-01-06','2008-01-07','2008-01-08','2008-01-09','2008-01-10','2008-01-11',
   '2008-01-12','2008-01-13','2008-01-14','2008-01-15','2008-01-16','2008-01-17',
@@ -183,7 +195,7 @@ Client.all(:conditions =&gt; [&quot;created_at IN (?)&quot;,
 
 [source, sql]
 -------------------------------------------------------
-SELECT * FROM +users+ WHERE (created_at IN 
+SELECT * FROM users WHERE (created_at IN 
   ('2007-12-01 00:00:00', '2007-12-01 00:00:01' ... 
   '2007-12-01 23:59:59', '2007-12-02 00:00:00'))
 -------------------------------------------------------
@@ -214,7 +226,7 @@ Client.all(:conditions =&gt;
 
 Just like in Ruby.
 
-=== Hash Conditions ===
+=== Placeholder Conditions ===
 
 Similar to the array style of params you can also specify keys in your conditions:
 
@@ -234,6 +246,8 @@ If you're getting a set of records and want to force an order, you can use +Clie
 
 To select certain fields, you can use the select option like this: +Client.first(:select =&gt; &quot;viewable_by, locked&quot;)+. This select option does not use an array of fields, but rather requires you to type SQL-like code. The above code will execute +SELECT viewable_by, locked FROM clients LIMIT 0,1+ on your database. 
 
+You can also call SQL functions within the select option. For example, if you would like to only grab a single record per unique value in a certain field by using the +DISTINCT+ function you can do it like this: +Client.all(:select =&gt; &quot;DISTINCT(name)&quot;)+.
+
 == Limit &amp; Offset
 
 If you want to limit the amount of records to a certain subset of all the records retrieved you usually use limit for this, sometimes coupled with offset. Limit is the maximum number of records that will be retrieved from a query, and offset is the number of records it will start reading from from the first record of the set. Take this code for example:
@@ -277,7 +291,7 @@ The SQL that would be executed would be something like this:
 
 [source, sql]
 -------------------------------------------------------
-SELECT * FROM +orders+ GROUP BY date(created_at)
+SELECT * FROM orders GROUP BY date(created_at)
 -------------------------------------------------------
 
 == Read Only
@@ -357,20 +371,27 @@ Client.first(:include =&gt; &quot;orders&quot;, :conditions =&gt;
 
 == Dynamic finders
 
-For every field (also known as an attribute) you define in your table, Active Record provides a finder method. If you have a field called +name+ on your Client model for example, you get +find_by_name+ and +find_all_by_name+ for free from Active Record. If you have also have a +locked+ field on the client model, you also get +find_by_locked+ and +find_all_by_locked+. If you want to find both by name and locked, you can chain these finders together by simply typing +and+ between the fields for example +Client.find_by_name_and_locked('Ryan', true)+. These finders are an excellent alternative to using the conditions option, mainly because it's shorter to type +find_by_name(params[:name])+ than it is to type +first(:conditions =&gt; [&quot;name = ?&quot;, params[:name]])+. 
+For every field (also known as an attribute) you define in your table, Active Record provides a finder method. If you have a field called +name+ on your Client model for example, you get +find_by_name+ and +find_all_by_name+ for free from Active Record. If you have also have a +locked+ field on the client model, you also get +find_by_locked+ and +find_all_by_locked+. 
+
+You can do +find_last_by_*+ methods too which will find the last record matching your parameter.
+
+You can specify an exclamation point (!) on the end of the dynamic finders to get them to raise an +ActiveRecord::RecordNotFound+ error if they do not return any records, like +Client.find_by_name!('Ryan')+
+
+If you want to find both by name and locked, you can chain these finders together by simply typing +and+ between the fields for example +Client.find_by_name_and_locked('Ryan', true)+. 
+
 
 There's another set of dynamic finders that let you find or create/initialize objects if they aren't find. These work in a similar fashion to the other finders and can be used like +find_or_create_by_name(params[:name])+. Using this will firstly perform a find and then create if the find returns nil. The SQL looks like this for +Client.find_or_create_by_name('Ryan')+:
 
 [source,sql]
 -------------------------------------------------------
-SELECT * FROM +clients+ WHERE (+clients+.+name+ = 'Ryan') LIMIT 1
+SELECT * FROM clients WHERE (clients.name = 'Ryan') LIMIT 1
 BEGIN
-INSERT INTO +clients+ (+name+, +updated_at+, +created_at+, +orders_count+, +locked+) 
+INSERT INTO clients (name, updated_at, created_at, orders_count, locked) 
   VALUES('Ryan', '2008-09-28 15:39:12', '2008-09-28 15:39:12', '0', '0')
 COMMIT
 -------------------------------------------------------
 
-+find_or_create+'s sibling, +find_or_initialize+, will find an object and if it does not exist will call +new+ with the parameters you passed in. For example:
++find_or_create+'s sibling, +find_or_initialize+, will find an object and if it does not exist will act similar to calling +new+ with the parameters you passed in. For example:
 
 [source, ruby]
 -------------------------------------------------------
@@ -379,6 +400,7 @@ client = Client.find_or_initialize_by_name('Ryan')
 
 will either assign an existing client object with the name 'Ryan' to the client local variable, or initialize new object similar to calling +Client.new(:name =&gt; 'Ryan')+. From here, you can modify other fields in client by calling the attribute setters on it: +client.locked = true+ and when you want to write it to the database just call +save+ on it.
 
+
 == Finding By SQL
 
 If you'd like to use your own SQL to find records a table you can use +find_by_sql+. The +find_by_sql+ method will return an array of objects even if it only returns a single record in it's call to the database. For example you could run this query:
@@ -571,7 +593,7 @@ Which will execute:
 
 [source, sql]
 -------------------------------------------------------
-SELECT count(*) AS count_all FROM +clients+ WHERE (first_name = 1) 
+SELECT count(*) AS count_all FROM clients WHERE (first_name = 1) 
 -------------------------------------------------------
 
 You can also use +include+ or +joins+ for this to do something a little more complex:
@@ -585,8 +607,8 @@ Which will execute:
 
 [source, sql]
 -------------------------------------------------------
-SELECT count(DISTINCT +clients+.id) AS count_all FROM +clients+ 
-  LEFT OUTER JOIN +orders+ ON orders.client_id = client.id WHERE 
+SELECT count(DISTINCT clients.id) AS count_all FROM clients 
+  LEFT OUTER JOIN orders ON orders.client_id = client.id WHERE 
   (clients.first_name = 'name' AND orders.status = 'received') 
 -------------------------------------------------------
 
@@ -655,6 +677,10 @@ Thanks to Mike Gunderloy for his tips on creating this guide.
 
 http://rails.lighthouseapp.com/projects/16213-rails-guides/tickets/16[Lighthouse ticket]
 
+* December 1 2008: Added using an SQL function example to Selecting Certain Fields section as per http://rails.lighthouseapp.com/projects/16213/tickets/36-adding-an-example-for-using-distinct-to-ar-finders[this ticket]
+* November 23 2008: Added documentation for +find_by_last+ and +find_by_bang!+
+* November 21 2008: Fixed all points specified in http://rails.lighthouseapp.com/projects/16213-rails-guides/tickets/16-activerecord-finders#ticket-16-13[this comment] and http://rails.lighthouseapp.com/projects/16213-rails-guides/tickets/16-activerecord-finders#ticket-16-14[this comment]
+* November 18 2008: Fixed all points specified in http://rails.lighthouseapp.com/projects/16213-rails-guides/tickets/16-activerecord-finders#ticket-16-11[this comment]
 * November 8, 2008: Editing pass by link:../authors.html#mgunderloy[Mike Gunderloy] . First release version.
 * October 27, 2008: Added scoped section, added named params for conditions and added sub-section headers for conditions section by Ryan Bigg
 * October 27, 2008: Fixed up all points specified in http://rails.lighthouseapp.com/projects/16213-rails-guides/tickets/16-activerecord-finders#ticket-16-6[this comment] with an exception of the final point by Ryan Bigg</diff>
      <filename>railties/doc/guides/source/finders.txt</filename>
    </modified>
    <modified>
      <diff>@@ -154,6 +154,13 @@ And if you're using PostgreSQL for data storage, run this command:
 $ rails blog -d postgresql
 -------------------------------------------------------
 
+After you create the blog application, switch to its folder to continue work directly in that application:
+
+[source, shell]
+-------------------------------------------------------
+$ cd blog
+-------------------------------------------------------
+
 In any case, Rails will create a folder in your working directory called +blog+. Open up that folder and explore its contents. Most of the work in this tutorial will happen in the +app/+ folder, but here's a basic rundown on the function of each folder that Rails creates in a new application by default:
 
 [grid=&quot;all&quot;]
@@ -239,6 +246,15 @@ development:
 
 Change the username and password in the +development+ section as appropriate.
 
+==== Creating the Database
+
+Now that you have your database configured, it's time to have Rails create an empty database for you. You can do this by running a rake command:
+
+[source, shell]
+-------------------------------------------------------
+$ rake db:create
+-------------------------------------------------------
+
 == Hello, Rails!
 
 One of the traditional places to start with a new language is by getting some text up on screen quickly. To do that in Rails, you need to create at minimum a controller and a view. Fortunately, you can do that in a single command. Enter this command in your terminal:
@@ -370,7 +386,7 @@ end
 
 If you were to translate that into words, it says something like: when this migration is run, create a table named +posts+ with two string columns (+name+ and +title+) and a text column (+content+), and generate timestamp fields to track record creation and updating. You can learn the detailed syntax for migrations in the link:../migrations.html[Rails Database Migrations] guide.
 
-At this point, you need to do two things: create the database and run the migration. You can use rake commands at the terminal for both of those tasks:
+At this point, you can use a rake command to run the migration:
 
 [source, shell]
 -------------------------------------------------------
@@ -378,7 +394,7 @@ $ rake db:create
 $ rake db:migrate
 -------------------------------------------------------
 
-NOTE: Because you're working in the development environment by default, both of these commands will apply to the database defined in the +development+ section of your +config/database.yml+ file.
+NOTE: Because you're working in the development environment by default, this command will apply to the database defined in the +development+ section of your +config/database.yml+ file.
 
 === Adding a Link
 
@@ -748,7 +764,7 @@ At this point, it&#8217;s worth looking at some of the tools that Rails provides to
 
 === Using Partials to Eliminate View Duplication
 
-As you saw earlier, the scaffold-generated views for the +new+ and +edit+ actions are largely identical. You can pull the shared code out into a +partial+ template. This requires editing the new and edit views, and adding a new template:
+As you saw earlier, the scaffold-generated views for the +new+ and +edit+ actions are largely identical. You can pull the shared code out into a +partial+ template. This requires editing the new and edit views, and adding a new template. The new +_form.html.erb+ template should be saved in the same +app/views/posts+ folder as the files from which it is being extracted:
 
 +new.html.erb+:
 
@@ -1021,7 +1037,7 @@ class CommentsController &lt; ApplicationController
 
   def show
     @post = Post.find(params[:post_id])
-    @comment = Comment.find(params[:id])
+    @comment = @post.comments.find(params[:id])
   end
 
   def new
@@ -1033,7 +1049,7 @@ class CommentsController &lt; ApplicationController
     @post = Post.find(params[:post_id])
     @comment = @post.comments.build(params[:comment])
     if @comment.save
-      redirect_to post_comment_path(@post, @comment)
+      redirect_to post_comment_url(@post, @comment)
     else
       render :action =&gt; &quot;new&quot;
     end
@@ -1041,14 +1057,14 @@ class CommentsController &lt; ApplicationController
   
   def edit
     @post = Post.find(params[:post_id])
-    @comment = Comment.find(params[:id])
+    @comment = @post.comments.find(params[:id])
   end
 
   def update
     @post = Post.find(params[:post_id])
     @comment = Comment.find(params[:id])
     if @comment.update_attributes(params[:comment])
-      redirect_to post_comment_path(@post, @comment)
+      redirect_to post_comment_url(@post, @comment)
     else
       render :action =&gt; &quot;edit&quot;
     end
@@ -1219,7 +1235,7 @@ Note that each post has its own individual comments collection, accessible as +@
 
 Now that you've seen your first Rails application, you should feel free to update it and experiment on your own. But you don't have to do everything without help. As you need assistance getting up and running with Rails, feel free to consult these support resources:
 
-* The link:http://manuals.rubyonrails.org/[Ruby On Rails guides]
+* The link:http://guides.rubyonrails.org/[Ruby On Rails guides]
 * The link:http://groups.google.com/group/rubyonrails-talk[Ruby on Rails mailing list]
 * The #rubyonrails channel on irc.freenode.net
 * The link:http://wiki.rubyonrails.org/rails[Rails wiki]</diff>
      <filename>railties/doc/guides/source/getting_started_with_rails.txt</filename>
    </modified>
    <modified>
      <diff>@@ -113,6 +113,16 @@ This guide covers ways to analyze and optimize your running Rails code.
 This guide covers how to build a plugin to extend the functionality of Rails.
 ***********************************************************
 
+.link:i18n.html[The Rails Internationalization API]
+***********************************************************
+CAUTION: still a basic draft
+
+This guide introduces you to the basic concepts and features of the Rails I18n API and shows you how to localize your application.
+***********************************************************
+
+
+
+
 Authors who have contributed to complete guides are listed link:authors.html[here].
 
 This work is licensed under a link:http://creativecommons.org/licenses/by-nc-sa/3.0/[Creative Commons Attribution-Noncommercial-Share Alike 3.0  License]</diff>
      <filename>railties/doc/guides/source/index.txt</filename>
    </modified>
    <modified>
      <diff>@@ -1,7 +1,7 @@
 Migrations
 ==========
 
-Migrations are a convenient way for you to alter your database in a structured and organised manner. You could edit fragments of SQL by hand but you would then be responsible for telling other developers that they need to go and run it. You'd also have to keep track of which changes need to be run against the production machines next time you deploy. Active Record tracks which migrations have already been run so all you have to do is update your source and run `rake db:migrate`. Active Record will work out which migrations should be run.
+Migrations are a convenient way for you to alter your database in a structured and organised manner. You could edit fragments of SQL by hand but you would then be responsible for telling other developers that they need to go and run it. You'd also have to keep track of which changes need to be run against the production machines next time you deploy. Active Record tracks which migrations have already been run so all you have to do is update your source and run `rake db:migrate`. Active Record will work out which migrations should be run. It will also update your db/schema.rb file to match the structure of your database. 
 
 Migrations also allow you to describe these transformations using Ruby. The great thing about this is that (like most of Active Record's functionality) it is database independent: you don't need to worry about the precise syntax of CREATE TABLE any more that you worry about variations on SELECT * (you can drop down to raw SQL for database specific features). For example you could use SQLite3 in development, but MySQL in production.
 </diff>
      <filename>railties/doc/guides/source/migrations/index.txt</filename>
    </modified>
    <modified>
      <diff>@@ -2,6 +2,8 @@
 
 Rails provides a set of rake tasks to work with migrations which boils down to running certain sets of migrations. The very first migration related rake task you use will probably be `db:migrate`. In its most basic form it just runs the `up` method for all the migrations that have not yet been run. If there are no such migrations it exits.
 
+Note that running the `db:migrate` also invokes the `db:schema:dump` task, which will update your db/schema.rb file to match the structure of your database.
+
 If you specify a target version, Active Record will run the required migrations (up or down) until it has reached the specified version. The
 version is the numerical prefix on the migration's filename. For example to migrate to version 20080906120000 run
 </diff>
      <filename>railties/doc/guides/source/migrations/rakeing_around.txt</filename>
    </modified>
    <modified>
      <diff>@@ -424,7 +424,7 @@ In this case, all of the normal routes except the route for +destroy+ (a +DELETE
 
 In addition to an action or a list of actions, you can also supply the special symbols +:all+ or +:none+ to the +:only+ and +:except+ options.
 
-TIP: If your application has many RESTful routes, using +:only+ and +:accept+ to generate only the routes that you actually need can cut down on memory use and speed up the routing process.
+TIP: If your application has many RESTful routes, using +:only+ and +:except+ to generate only the routes that you actually need can cut down on memory use and speed up the routing process.
 
 === Nested Resources
 
@@ -738,7 +738,7 @@ You do not need to explicitly use the +:controller+ and +:action+ symbols within
 
 [source, ruby]
 -------------------------------------------------------
-map.connect 'photo/:id', :controller =&gt; 'photos', :action =&gt; 'show'
+map.connect 'photos/:id', :controller =&gt; 'photos', :action =&gt; 'show'
 -------------------------------------------------------
 
 With this route, an incoming URL of +/photos/12+ would be dispatched to the +show+ action within the +Photos+ controller.
@@ -747,7 +747,7 @@ You an also define other defaults in a route by supplying a hash for the +:defau
 
 [source, ruby]
 -------------------------------------------------------
-map.connect 'photo/:id', :controller =&gt; 'photos', :action =&gt; 'show', :defaults =&gt; { :format =&gt; 'jpg' }
+map.connect 'photos/:id', :controller =&gt; 'photos', :action =&gt; 'show', :defaults =&gt; { :format =&gt; 'jpg' }
 -------------------------------------------------------
 
 With this route, an incoming URL of +photos/12+ would be dispatched to the +show+ action within the +Photos+ controller, and +params[:format]+ will be set to +jpg+.
@@ -886,7 +886,7 @@ For better readability, you can specify an already-created route in your call to
 
 [source, ruby]
 -------------------------------------------------------
-map.index :controller =&gt; &quot;pages&quot;, :action =&gt; &quot;main&quot;
+map.index 'index', :controller =&gt; &quot;pages&quot;, :action =&gt; &quot;main&quot;
 map.root :index
 -------------------------------------------------------
 </diff>
      <filename>railties/doc/guides/source/routing_outside_in.txt</filename>
    </modified>
    <modified>
      <diff>@@ -97,6 +97,10 @@ ul li {
 	background-position:		0 0.55em;
 }
 
+ul li p {
+  margin-bottom: 0.5em;
+}
+
 /* ----------------------------------------------------------------------------
 	Structure
 ---------------------------------------------------------------------------- */</diff>
      <filename>railties/doc/guides/source/stylesheets/base.css</filename>
    </modified>
    <modified>
      <diff>@@ -229,7 +229,7 @@ NOTE: +db:test:prepare+ will fail with an error if db/schema.rb doesn't exists.
 ==== Rake Tasks for Preparing you Application for Testing ==
 
 [grid=&quot;all&quot;]
---------------------------------`----------------------------------------------------
+------------------------------------------------------------------------------------
 Tasks                           Description
 ------------------------------------------------------------------------------------
 +rake db:test:clone+            Recreate the test database from the current environment's database schema
@@ -239,7 +239,7 @@ Tasks                           Description
 +rake db:test:purge+            Empty the test database.
 ------------------------------------------------------------------------------------
 
-TIP: You can see all these rake tasks and their descriptions by running +rake --tasks --describe+
+TIP: You can see all these rake tasks and their descriptions by running +rake \-\-tasks \-\-describe+
 
 === Running Tests ===
 
@@ -768,7 +768,7 @@ end
 You don't need to set up and run your tests by hand on a test-by-test basis. Rails comes with a number of rake tasks to help in testing. The table below lists all rake tasks that come along in the default Rakefile when you initiate a Rail project.
 
 [grid=&quot;all&quot;]
---------------------------------`----------------------------------------------------
+------------------------------------------------------------------------------------
 Tasks                           Description
 ------------------------------------------------------------------------------------
 +rake test+                     Runs all unit, functional and integration tests. You can also simply run +rake+ as the _test_ target is the default.</diff>
      <filename>railties/doc/guides/source/testing_rails_applications.txt</filename>
    </modified>
    <modified>
      <diff>@@ -110,7 +110,7 @@ namespace :db do
   end
 
 
-  desc &quot;Migrate the database through scripts in db/migrate. Target specific version with VERSION=x. Turn off output with VERBOSE=false.&quot;
+  desc &quot;Migrate the database through scripts in db/migrate and update db/schema.rb by invoking db:schema:dump. Target specific version with VERSION=x. Turn off output with VERBOSE=false.&quot;
   task :migrate =&gt; :environment do
     ActiveRecord::Migration.verbose = ENV[&quot;VERBOSE&quot;] ? ENV[&quot;VERBOSE&quot;] == &quot;true&quot; : true
     ActiveRecord::Migrator.migrate(&quot;db/migrate/&quot;, ENV[&quot;VERSION&quot;] ? ENV[&quot;VERSION&quot;].to_i : nil)</diff>
      <filename>railties/lib/tasks/databases.rake</filename>
    </modified>
  </modified>
  <removed type="array">
    <removed>
      <filename>railties/doc/guides/source/creating_plugins/custom_route.txt</filename>
    </removed>
    <removed>
      <filename>railties/doc/guides/source/creating_plugins/migration_generator.txt</filename>
    </removed>
    <removed>
      <filename>railties/doc/guides/source/creating_plugins/odds_and_ends.txt</filename>
    </removed>
  </removed>
  <parents type="array">
    <parent>
      <id>9eca588bdfbb41f6b48477025d1cd8eea4a38296</id>
    </parent>
  </parents>
  <author>
    <name>Pratik Naik</name>
    <email>pratiknaik@gmail.com</email>
  </author>
  <url>http://github.com/relevance/rails/commit/dbbae5e00e49d3a69dc10978e38299e3f28dd1e1</url>
  <id>dbbae5e00e49d3a69dc10978e38299e3f28dd1e1</id>
  <committed-date>2008-12-06T18:27:53-08:00</committed-date>
  <authored-date>2008-12-06T18:27:53-08:00</authored-date>
  <message>Merge with docrails</message>
  <tree>592710207a614428d5cb809f6e13c8b546b58969</tree>
  <committer>
    <name>Pratik Naik</name>
    <email>pratiknaik@gmail.com</email>
  </committer>
</commit>
