Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove all the guides

  • Loading branch information...
commit e4094e23f9e3740599e9eaac527fbef86ff4b4c4 1 parent c0eeb9f
Pratik lifo authored
Showing with 0 additions and 27,181 deletions.
  1. +0 −64 railties/Rakefile
  2. +0 −26 railties/doc/guides/asciidoc.conf
  3. +0 −1,011 railties/doc/guides/html/2_2_release_notes.html
  4. +0 −1,033 railties/doc/guides/html/2_3_release_notes.html
  5. +0 −735 railties/doc/guides/html/action_mailer_basics.html
  6. +0 −1,080 railties/doc/guides/html/actioncontroller_basics.html
  7. +0 −342 railties/doc/guides/html/active_record_basics.html
  8. +0 −932 railties/doc/guides/html/active_record_querying.html
  9. +0 −1,231 railties/doc/guides/html/activerecord_validations_callbacks.html
  10. +0 −2,348 railties/doc/guides/html/association_basics.html
  11. +0 −87 railties/doc/guides/html/authors.html
  12. +0 −480 railties/doc/guides/html/caching_with_rails.html
  13. +0 −545 railties/doc/guides/html/command_line.html
  14. +0 −352 railties/doc/guides/html/configuring.html
  15. +0 −1,678 railties/doc/guides/html/creating_plugins.html
  16. +0 −992 railties/doc/guides/html/debugging_rails_applications.html
  17. +0 −983 railties/doc/guides/html/form_helpers.html
  18. +0 −1,873 railties/doc/guides/html/getting_started_with_rails.html
  19. +0 −1,275 railties/doc/guides/html/i18n.html
  20. +0 −222 railties/doc/guides/html/index.html
  21. +0 −1,278 railties/doc/guides/html/layouts_and_rendering.html
  22. +0 −731 railties/doc/guides/html/migrations.html
  23. +0 −728 railties/doc/guides/html/performance_testing.html
  24. +0 −450 railties/doc/guides/html/rails_on_rack.html
  25. +0 −1,591 railties/doc/guides/html/routing_outside_in.html
  26. +0 −1,153 railties/doc/guides/html/security.html
  27. +0 −1,551 railties/doc/guides/html/testing_rails_applications.html
  28. +0 −437 railties/doc/guides/source/2_2_release_notes.txt
  29. +0 −514 railties/doc/guides/source/2_3_release_notes.txt
  30. +0 −479 railties/doc/guides/source/action_mailer_basics.txt
  31. +0 −5 railties/doc/guides/source/actioncontroller_basics/changelog.txt
  32. +0 −34 railties/doc/guides/source/actioncontroller_basics/cookies.txt
  33. +0 −32 railties/doc/guides/source/actioncontroller_basics/csrf.txt
  34. +0 −119 railties/doc/guides/source/actioncontroller_basics/filters.txt
  35. +0 −57 railties/doc/guides/source/actioncontroller_basics/http_auth.txt
  36. +0 −40 railties/doc/guides/source/actioncontroller_basics/index.txt
  37. +0 −9 railties/doc/guides/source/actioncontroller_basics/introduction.txt
  38. +0 −39 railties/doc/guides/source/actioncontroller_basics/methods.txt
  39. +0 −14 railties/doc/guides/source/actioncontroller_basics/parameter_filtering.txt
  40. +0 −93 railties/doc/guides/source/actioncontroller_basics/params.txt
  41. +0 −43 railties/doc/guides/source/actioncontroller_basics/request_response_objects.txt
  42. +0 −67 railties/doc/guides/source/actioncontroller_basics/rescue.txt
  43. +0 −156 railties/doc/guides/source/actioncontroller_basics/session.txt
  44. +0 −91 railties/doc/guides/source/actioncontroller_basics/streaming.txt
  45. +0 −40 railties/doc/guides/source/actioncontroller_basics/verification.txt
  46. +0 −141 railties/doc/guides/source/active_record_basics.txt
Sorry, we could not display the entire diff because it was too big.
64 railties/Rakefile
View
@@ -272,70 +272,6 @@ Rake::RDocTask.new { |rdoc|
rdoc.rdoc_files.include('lib/commands/**/*.rb')
}
-desc "Generate guides for the framework. Use ONLY='migrations i18n.txt' option to build just specific ones."
-task :guides do
- require 'mizuho/generator'
-
- source = "doc/guides/source/"
- html = "doc/guides/html/"
- FileUtils.rm_r(html) if File.directory?(html)
- FileUtils.mkdir(html)
-
- template = File.expand_path("doc/guides/source/templates/guides.html.erb")
- asciidoc_conf = 'doc/guides/asciidoc.conf'
-
- ignore = ['..', 'icons', 'images', 'templates', 'stylesheets']
- #ignore << 'active_record_basics.txt'
-
- indexless = ['index.txt', 'authors.txt']
-
- # Traverse all entries in doc/guides/source/ or only those specified in ONLY env variable
- entries = Dir.entries(source)
- if ENV['ONLY']
- only = ENV['ONLY'].split(' ')
- unless only.empty?
- entries = entries.select do |e|
- only.include?(e) || only.include?(e.sub(/\.txt$/, ''))
- end
- end
- end
-
- entries.each do |entry|
- next if ignore.include?(entry) or entry =~ /^\./ # because Vim is always saving hidden swap files
-
- if File.directory?(File.join(source, entry))
- # If the current entry is a directory, then we will want to compile
- # the 'index.txt' file inside this directory.
- if entry == '.'
- input = File.join(source, 'index.txt')
- output = File.join(html, "index.html")
- else
- input = File.join(source, entry, 'index.txt')
- output = File.join(html, "#{entry}.html")
- end
- else
- # If the current entry is a file, then we will want to compile this file.
- input = File.join(source, entry)
- output = File.join(html, entry).sub(/\.txt$/, '.html')
- end
-
- begin
- puts "GENERATING => #{output}"
- ENV['MANUALSONRAILS_TOC'] = 'no' if indexless.include?(entry)
- Mizuho::Generator.new(input, :output => output, :template => template, :conf_file => asciidoc_conf).start
- rescue Mizuho::GenerationError
- STDERR.puts "*** ERROR"
- exit 2
- ensure
- ENV.delete('MANUALSONRAILS_TOC')
- end
- end
-
- # Copy images and css files to html directory. These dirs are in .gitigore and shouldn't be source controlled.
- FileUtils.cp_r File.join(source, 'images'), File.join(html, 'images')
- FileUtils.cp_r File.join(source, 'stylesheets'), File.join(html, 'stylesheets')
-end
-
# Generate GEM ----------------------------------------------------------------------------
task :copy_gem_environment do
26 railties/doc/guides/asciidoc.conf
View
@@ -1,26 +0,0 @@
-# Asciidoc substitutes some characters by default, those are called
-# "replacements" in the docs. For example => becomes a unicode arrow.
-#
-# We override replacements to allow copy & paste of source code.
-
-[replacements]
-
-# Ellipsis
-(?<!\\)\.\.\.=...
-\\\.\.\.=...
-
-# -> right arrow
-(?<!\\)-&gt;==-&gt;
-\\-&gt;=-&gt;
-
-# => right double arrow
-(?<!\\)\=&gt;==&gt;
-\\\=&gt;==&gt;
-
-# <- left arrow
-(?<!\\)&lt;-=&lt;-
-\\&lt;-=&lt;-
-
-# <= left double arrow
-(?<!\\)&lt;\==&lt;=
-\\&lt;\==&lt;=
1,011 railties/doc/guides/html/2_2_release_notes.html
View
@@ -1,1011 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title>Ruby on Rails 2.2 Release Notes</title>
- <!--[if lt IE 8]>
- <script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js" type="text/javascript"></script>
- <![endif]-->
- <link href="stylesheets/base.css" media="screen" rel="Stylesheet" type="text/css" />
- <link href="stylesheets/forms.css" media="screen" rel="Stylesheet" type="text/css" />
- <link href="stylesheets/more.css" media="screen" rel="Stylesheet" type="text/css" />
-</head>
-<body>
- <div id="header" >
- <div id="logo">
- <a href="index.html" title="Ruby on Rails"><img src="images/rails_logo_remix.gif" alt="Rails" height="140" width="110" /></a>
- </div>
-
- <h1 id="site_title"><span>Ruby on Rails</span></h1>
- <h2 id="site_title_tagline">Sustainable productivity for web-application development</h2>
-
- <ul id="navMain">
- <li class="first-child"><a href="http://www.rubyonrails.org/" title="Ruby on Rails" class="ruby_on_rails">Ruby on Rails</a></li>
- <li><a class="manuals" href="index.html" title="Manuals Index">Guides Index</a></li>
- </ul>
- </div>
-
- <div id="container">
-
- <div id="sidebar">
- <h2>Chapters</h2>
- <ol>
- <li>
- <a href="#_infrastructure">Infrastructure</a>
- <ul>
-
- <li><a href="#_internationalization">Internationalization</a></li>
-
- <li><a href="#_compatibility_with_ruby_1_9_and_jruby">Compatibility with Ruby 1.9 and JRuby</a></li>
-
- </ul>
- </li>
- <li>
- <a href="#_documentation">Documentation</a>
- </li>
- <li>
- <a href="#_better_integration_with_http_out_of_the_box_etag_support">Better integration with HTTP : Out of the box ETag support</a>
- </li>
- <li>
- <a href="#_thread_safety">Thread Safety</a>
- </li>
- <li>
- <a href="#_active_record">Active Record</a>
- <ul>
-
- <li><a href="#_transactional_migrations">Transactional Migrations</a></li>
-
- <li><a href="#_connection_pooling">Connection Pooling</a></li>
-
- <li><a href="#_hashes_for_join_table_conditions">Hashes for Join Table Conditions</a></li>
-
- <li><a href="#_new_dynamic_finders">New Dynamic Finders</a></li>
-
- <li><a href="#_associations_respect_private_protected_scope">Associations Respect Private/Protected Scope</a></li>
-
- <li><a href="#_other_activerecord_changes">Other ActiveRecord Changes</a></li>
-
- </ul>
- </li>
- <li>
- <a href="#_action_controller">Action Controller</a>
- <ul>
-
- <li><a href="#_shallow_route_nesting">Shallow Route Nesting</a></li>
-
- <li><a href="#_method_arrays_for_member_or_collection_routes">Method Arrays for Member or Collection Routes</a></li>
-
- <li><a href="#_resources_with_specific_actions">Resources With Specific Actions</a></li>
-
- <li><a href="#_other_action_controller_changes">Other Action Controller Changes</a></li>
-
- </ul>
- </li>
- <li>
- <a href="#_action_view">Action View</a>
- </li>
- <li>
- <a href="#_action_mailer">Action Mailer</a>
- </li>
- <li>
- <a href="#_active_support">Active Support</a>
- <ul>
-
- <li><a href="#_memoization">Memoization</a></li>
-
- <li><a href="#_tt_each_with_object_tt"><tt>each_with_object</tt></a></li>
-
- <li><a href="#_delegates_with_prefixes">Delegates With Prefixes</a></li>
-
- <li><a href="#_other_active_support_changes">Other Active Support Changes</a></li>
-
- </ul>
- </li>
- <li>
- <a href="#_railties">Railties</a>
- <ul>
-
- <li><a href="#_tt_config_gems_tt"><tt>config.gems</tt></a></li>
-
- <li><a href="#_other_railties_changes">Other Railties Changes</a></li>
-
- </ul>
- </li>
- <li>
- <a href="#_deprecated">Deprecated</a>
- </li>
- <li>
- <a href="#_credits">Credits</a>
- </li>
- </ol>
- </div>
-
- <div id="content">
- <h1>Ruby on Rails 2.2 Release Notes</h1>
- <div id="preamble">
-<div class="sectionbody">
-<div class="paragraph"><p>Rails 2.2 delivers a number of new and improved features. This list covers the major upgrades, but doesn&#8217;t include every little bug fix and change. If you want to see everything, check out the <a href="http://github.com/rails/rails/commits/master">list of commits</a> in the main Rails repository on GitHub.</p></div>
-<div class="paragraph"><p>Along with Rails, 2.2 marks the launch of the <a href="http://guides.rubyonrails.org/">Ruby on Rails Guides</a>, the first results of the ongoing <a href="http://hackfest.rubyonrails.org/guide">Rails Guides hackfest</a>. This site will deliver high-quality documentation of the major features of Rails.</p></div>
-</div>
-</div>
-<h2 id="_infrastructure">1. Infrastructure</h2>
-<div class="sectionbody">
-<div class="paragraph"><p>Rails 2.2 is a significant release for the infrastructure that keeps Rails humming along and connected to the rest of the world.</p></div>
-<h3 id="_internationalization">1.1. Internationalization</h3>
-<div class="paragraph"><p>Rails 2.2 supplies an easy system for internationalization (or i18n, for those of you tired of typing).</p></div>
-<div class="ulist"><ul>
-<li>
-<p>
-Lead Contributors: Rails i18 Team
-</p>
-</li>
-<li>
-<p>
-More information :
-</p>
-<div class="ulist"><ul>
-<li>
-<p>
-<a href="http://rails-i18n.org">Official Rails i18 website</a>
-</p>
-</li>
-<li>
-<p>
-<a href="http://www.artweb-design.de/2008/7/18/finally-ruby-on-rails-gets-internationalized">Finally. Ruby on Rails gets internationalized</a>
-</p>
-</li>
-<li>
-<p>
-<a href="http://i18n-demo.phusion.nl">Localizing Rails : Demo application</a>
-</p>
-</li>
-</ul></div>
-</li>
-</ul></div>
-<h3 id="_compatibility_with_ruby_1_9_and_jruby">1.2. Compatibility with Ruby 1.9 and JRuby</h3>
-<div class="paragraph"><p>Along with thread safety, a lot of work has been done to make Rails work well with JRuby and the upcoming Ruby 1.9. With Ruby 1.9 being a moving target, running edge Rails on edge Ruby is still a hit-or-miss proposition, but Rails is ready to make the transition to Ruby 1.9 when the latter is released.</p></div>
-</div>
-<h2 id="_documentation">2. Documentation</h2>
-<div class="sectionbody">
-<div class="paragraph"><p>The internal documentation of Rails, in the form of code comments, has been improved in numerous places. In addition, the <a href="http://guides.rubyonrails.org/">Ruby on Rails Guides</a> project is the definitive source for information on major Rails components. In its first official release, the Guides page includes:</p></div>
-<div class="ulist"><ul>
-<li>
-<p>
-<a href="http://guides.rubyonrails.org/getting_started_with_rails.html">Getting Started with Rails</a>
-</p>
-</li>
-<li>
-<p>
-<a href="http://guides.rubyonrails.org/migrations.html">Rails Database Migrations</a>
-</p>
-</li>
-<li>
-<p>
-<a href="http://guides.rubyonrails.org/association_basics.html">Active Record Associations</a>
-</p>
-</li>
-<li>
-<p>
-<a href="http://guides.rubyonrails.org/finders.html">Active Record Finders</a>
-</p>
-</li>
-<li>
-<p>
-<a href="http://guides.rubyonrails.org/layouts_and_rendering.html">Layouts and Rendering in Rails</a>
-</p>
-</li>
-<li>
-<p>
-<a href="http://guides.rubyonrails.org/form_helpers.html">Action View Form Helpers</a>
-</p>
-</li>
-<li>
-<p>
-<a href="http://guides.rubyonrails.org/routing_outside_in.html">Rails Routing from the Outside In</a>
-</p>
-</li>
-<li>
-<p>
-<a href="http://guides.rubyonrails.org/actioncontroller_basics.html">Basics of Action Controller</a>
-</p>
-</li>
-<li>
-<p>
-<a href="http://guides.rubyonrails.org/caching_with_rails.html">Rails Caching</a>
-</p>
-</li>
-<li>
-<p>
-<a href="http://guides.rubyonrails.org/testing_rails_applications.html">Testing Rails Applications</a>
-</p>
-</li>
-<li>
-<p>
-<a href="http://guides.rubyonrails.org/security.html">Securing Rails Applications</a>
-</p>
-</li>
-<li>
-<p>
-<a href="http://guides.rubyonrails.org/debugging_rails_applications.html">Debugging Rails Applications</a>
-</p>
-</li>
-<li>
-<p>
-<a href="http://guides.rubyonrails.org/benchmarking_and_profiling.html">Benchmarking and Profiling Rails Applications</a>
-</p>
-</li>
-<li>
-<p>
-<a href="http://guides.rubyonrails.org/creating_plugins.html">The Basics of Creating Rails Plugins</a>
-</p>
-</li>
-</ul></div>
-<div class="paragraph"><p>All told, the Guides provide tens of thousands of words of guidance for beginning and intermediate Rails developers.</p></div>
-<div class="paragraph"><p>If you want to generate these guides locally, inside your application:</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt>rake doc<span style="color: #990000">:</span>guides</tt></pre></div></div>
-<div class="paragraph"><p>This will put the guides inside <tt>RAILS_ROOT/doc/guides</tt> and you may start surfing straight away by opening <tt>RAILS_ROOT/doc/guides/index.html</tt> in your favourite browser.</p></div>
-<div class="ulist"><ul>
-<li>
-<p>
-Lead Contributors: <a href="http://guides.rails.info/authors.html">Rails Documentation Team</a>
-</p>
-</li>
-<li>
-<p>
-Major contributions from <a href="http://advogato.org/person/fxn/diary.html">Xavier Noria</a> and <a href="http://izumi.plan99.net/blog/">Hongli Lai</a>.
-</p>
-</li>
-<li>
-<p>
-More information:
-</p>
-<div class="ulist"><ul>
-<li>
-<p>
-<a href="http://hackfest.rubyonrails.org/guide">Rails Guides hackfest</a>
-</p>
-</li>
-<li>
-<p>
-<a href="http://weblog.rubyonrails.org/2008/5/2/help-improve-rails-documentation-on-git-branch">Help improve Rails documentation on Git branch</a>
-</p>
-</li>
-</ul></div>
-</li>
-</ul></div>
-</div>
-<h2 id="_better_integration_with_http_out_of_the_box_etag_support">3. Better integration with HTTP : Out of the box ETag support</h2>
-<div class="sectionbody">
-<div class="paragraph"><p>Supporting the etag and last modified timestamp in HTTP headers means that Rails can now send back an empty response if it gets a request for a resource that hasn&#8217;t been modified lately. This allows you to check whether a response needs to be sent at all.</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">class</span></span> ArticlesController <span style="color: #990000">&lt;</span> ApplicationController
- <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> show_with_respond_to_block
- <span style="color: #009900">@article</span> <span style="color: #990000">=</span> Article<span style="color: #990000">.</span>find<span style="color: #990000">(</span>params<span style="color: #990000">[:</span>id<span style="color: #990000">])</span>
-
- <span style="font-style: italic"><span style="color: #9A1900"># If the request sends headers that differs from the options provided to stale?, then</span></span>
- <span style="font-style: italic"><span style="color: #9A1900"># the request is indeed stale and the respond_to block is triggered (and the options</span></span>
- <span style="font-style: italic"><span style="color: #9A1900"># to the stale? call is set on the response).</span></span>
- <span style="font-style: italic"><span style="color: #9A1900">#</span></span>
- <span style="font-style: italic"><span style="color: #9A1900"># If the request headers match, then the request is fresh and the respond_to block is</span></span>
- <span style="font-style: italic"><span style="color: #9A1900"># not triggered. Instead the default render will occur, which will check the last-modified</span></span>
- <span style="font-style: italic"><span style="color: #9A1900"># and etag headers and conclude that it only needs to send a "304 Not Modified" instead</span></span>
- <span style="font-style: italic"><span style="color: #9A1900"># of rendering the template.</span></span>
- <span style="font-weight: bold"><span style="color: #0000FF">if</span></span> stale?<span style="color: #990000">(:</span>last_modified <span style="color: #990000">=&gt;</span> <span style="color: #009900">@article</span><span style="color: #990000">.</span>published_at<span style="color: #990000">.</span>utc<span style="color: #990000">,</span> <span style="color: #990000">:</span>etag <span style="color: #990000">=&gt;</span> <span style="color: #009900">@article</span><span style="color: #990000">)</span>
- respond_to <span style="font-weight: bold"><span style="color: #0000FF">do</span></span> <span style="color: #990000">|</span>wants<span style="color: #990000">|</span>
- <span style="font-style: italic"><span style="color: #9A1900"># normal response processing</span></span>
- <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
- <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
- <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
-
- <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> show_with_implied_render
- <span style="color: #009900">@article</span> <span style="color: #990000">=</span> Article<span style="color: #990000">.</span>find<span style="color: #990000">(</span>params<span style="color: #990000">[:</span>id<span style="color: #990000">])</span>
-
- <span style="font-style: italic"><span style="color: #9A1900"># Sets the response headers and checks them against the request, if the request is stale</span></span>
- <span style="font-style: italic"><span style="color: #9A1900"># (i.e. no match of either etag or last-modified), then the default render of the template happens.</span></span>
- <span style="font-style: italic"><span style="color: #9A1900"># If the request is fresh, then the default render will return a "304 Not Modified"</span></span>
- <span style="font-style: italic"><span style="color: #9A1900"># instead of rendering the template.</span></span>
- fresh_when<span style="color: #990000">(:</span>last_modified <span style="color: #990000">=&gt;</span> <span style="color: #009900">@article</span><span style="color: #990000">.</span>published_at<span style="color: #990000">.</span>utc<span style="color: #990000">,</span> <span style="color: #990000">:</span>etag <span style="color: #990000">=&gt;</span> <span style="color: #009900">@article</span><span style="color: #990000">)</span>
- <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
-<span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
-</div>
-<h2 id="_thread_safety">4. Thread Safety</h2>
-<div class="sectionbody">
-<div class="paragraph"><p>The work done to make Rails thread-safe is rolling out in Rails 2.2. Depending on your web server infrastructure, this means you can handle more requests with fewer copies of Rails in memory, leading to better server performance and higher utilization of multiple cores.</p></div>
-<div class="paragraph"><p>To enable multithreaded dispatching in production mode of your application, add the following line in your <tt>config/environments/production.rb</tt>:</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt>config<span style="color: #990000">.</span>threadsafe!</tt></pre></div></div>
-<div class="ulist"><ul>
-<li>
-<p>
-More information :
-</p>
-<div class="ulist"><ul>
-<li>
-<p>
-<a href="http://m.onkey.org/2008/10/23/thread-safety-for-your-rails">Thread safety for your Rails</a>
-</p>
-</li>
-<li>
-<p>
-<a href="http://weblog.rubyonrails.org/2008/8/16/josh-peek-officially-joins-the-rails-core">Thread safety project announcement</a>
-</p>
-</li>
-<li>
-<p>
-<a href="http://blog.headius.com/2008/08/qa-what-thread-safe-rails-means.html">Q/A: What Thread-safe Rails Means</a>
-</p>
-</li>
-</ul></div>
-</li>
-</ul></div>
-</div>
-<h2 id="_active_record">5. Active Record</h2>
-<div class="sectionbody">
-<div class="paragraph"><p>There are two big additions to talk about here: transactional migrations and pooled database transactions. There&#8217;s also a new (and cleaner) syntax for join table conditions, as well as a number of smaller improvements.</p></div>
-<h3 id="_transactional_migrations">5.1. Transactional Migrations</h3>
-<div class="paragraph"><p>Historically, multiple-step Rails migrations have been a source of trouble. If something went wrong during a migration, everything before the error changed the database and everything after the error wasn&#8217;t applied. Also, the migration version was stored as having been executed, which means that it couldn&#8217;t be simply rerun by <tt>rake db:migrate:redo</tt> after you fix the problem. Transactional migrations change this by wrapping migration steps in a DDL transaction, so that if any of them fail, the entire migration is undone. In Rails 2.2, transactional migrations are supported on PostgreSQL out of the box. The code is extensible to other database types in the future - and IBM has already extended it to support the DB2 adapter.</p></div>
-<div class="ulist"><ul>
-<li>
-<p>
-Lead Contributor: <a href="http://adam.blog.heroku.com/">Adam Wiggins</a>
-</p>
-</li>
-<li>
-<p>
-More information:
-</p>
-<div class="ulist"><ul>
-<li>
-<p>
-<a href="http://adam.blog.heroku.com/past/2008/9/3/ddl_transactions/">DDL Transactions</a>
-</p>
-</li>
-<li>
-<p>
-<a href="http://db2onrails.com/2008/11/08/a-major-milestone-for-db2-on-rails/">A major milestone for DB2 on Rails</a>
-</p>
-</li>
-</ul></div>
-</li>
-</ul></div>
-<h3 id="_connection_pooling">5.2. Connection Pooling</h3>
-<div class="paragraph"><p>Connection pooling lets Rails distribute database requests across a pool of database connections that will grow to a maximum size (by default 5, but you can add a <tt>pool</tt> key to your <tt>database.yml</tt> to adjust this). This helps remove bottlenecks in applications that support many concurrent users. There&#8217;s also a <tt>wait_timeout</tt> that defaults to 5 seconds before giving up. <tt>ActiveRecord::Base.connection_pool</tt> gives you direct access to the pool if you need it.</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt>development<span style="color: #990000">:</span>
- adapter<span style="color: #990000">:</span> mysql
- username<span style="color: #990000">:</span> root
- database<span style="color: #990000">:</span> sample_development
- pool<span style="color: #990000">:</span> <span style="color: #993399">10</span>
- wait_timeout<span style="color: #990000">:</span> <span style="color: #993399">10</span></tt></pre></div></div>
-<div class="ulist"><ul>
-<li>
-<p>
-Lead Contributor: <a href="http://blog.nicksieger.com/">Nick Sieger</a>
-</p>
-</li>
-<li>
-<p>
-More information:
-</p>
-<div class="ulist"><ul>
-<li>
-<p>
-<a href="http://ryandaigle.com/articles/2008/9/7/what-s-new-in-edge-rails-connection-pools">What&#8217;s New in Edge Rails: Connection Pools</a>
-</p>
-</li>
-</ul></div>
-</li>
-</ul></div>
-<h3 id="_hashes_for_join_table_conditions">5.3. Hashes for Join Table Conditions</h3>
-<div class="paragraph"><p>You can now specify conditions on join tables using a hash. This is a big help if you need to query across complex joins.</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">class</span></span> Photo <span style="color: #990000">&lt;</span> ActiveRecord<span style="color: #990000">::</span>Base
- belongs_to <span style="color: #990000">:</span>product
-<span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
-
-<span style="font-weight: bold"><span style="color: #0000FF">class</span></span> Product <span style="color: #990000">&lt;</span> ActiveRecord<span style="color: #990000">::</span>Base
- has_many <span style="color: #990000">:</span>photos
-<span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
-
-<span style="font-style: italic"><span style="color: #9A1900"># Get all products with copyright-free photos:</span></span>
-Product<span style="color: #990000">.</span>all<span style="color: #990000">(:</span>joins <span style="color: #990000">=&gt;</span> <span style="color: #990000">:</span>photos<span style="color: #990000">,</span> <span style="color: #990000">:</span>conditions <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">{</span> <span style="color: #990000">:</span>photos <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">{</span> <span style="color: #990000">:</span>copyright <span style="color: #990000">=&gt;</span> <span style="font-weight: bold"><span style="color: #0000FF">false</span></span> <span style="color: #FF0000">}}</span><span style="color: #990000">)</span></tt></pre></div></div>
-<div class="ulist"><ul>
-<li>
-<p>
-More information:
-</p>
-<div class="ulist"><ul>
-<li>
-<p>
-<a href="http://ryandaigle.com/articles/2008/7/7/what-s-new-in-edge-rails-easy-join-table-conditions">What&#8217;s New in Edge Rails: Easy Join Table Conditions</a>
-</p>
-</li>
-</ul></div>
-</li>
-</ul></div>
-<h3 id="_new_dynamic_finders">5.4. New Dynamic Finders</h3>
-<div class="paragraph"><p>Two new sets of methods have been added to Active Record&#8217;s dynamic finders family.</p></div>
-<h4 id="_tt_find_last_by_lt_attribute_gt_tt">5.4.1. <tt>find_last_by_&lt;attribute&gt;</tt></h4>
-<div class="paragraph"><p>The <tt>find_last_by_&lt;attribute&gt;</tt> method is equivalent to <tt>Model.last(:conditions =&gt; {:attribute =&gt; value})</tt></p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="font-style: italic"><span style="color: #9A1900"># Get the last user who signed up from London</span></span>
-User<span style="color: #990000">.</span>find_last_by_city<span style="color: #990000">(</span><span style="color: #FF0000">'London'</span><span style="color: #990000">)</span></tt></pre></div></div>
-<div class="ulist"><ul>
-<li>
-<p>
-Lead Contributor: <a href="http://www.workingwithrails.com/person/9147-emilio-tagua">Emilio Tagua</a>
-</p>
-</li>
-</ul></div>
-<h4 id="_tt_find_by_lt_attribute_gt_tt">5.4.2. <tt>find_by_&lt;attribute&gt;!</tt></h4>
-<div class="paragraph"><p>The new bang! version of <tt>find_by_&lt;attribute&gt;!</tt> is equivalent to <tt>Model.first(:conditions =&gt; {:attribute =&gt; value}) || raise ActiveRecord::RecordNotFound</tt> Instead of returning <tt>nil</tt> if it can&#8217;t find a matching record, this method will raise an exception if it cannot find a match.</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="font-style: italic"><span style="color: #9A1900"># Raise ActiveRecord::RecordNotFound exception if 'Moby' hasn't signed up yet!</span></span>
-User<span style="color: #990000">.</span>find_by_name!<span style="color: #990000">(</span><span style="color: #FF0000">'Moby'</span><span style="color: #990000">)</span></tt></pre></div></div>
-<div class="ulist"><ul>
-<li>
-<p>
-Lead Contributor: <a href="http://blog.hasmanythrough.com">Josh Susser</a>
-</p>
-</li>
-</ul></div>
-<h3 id="_associations_respect_private_protected_scope">5.5. Associations Respect Private/Protected Scope</h3>
-<div class="paragraph"><p>Active Record association proxies now respect the scope of methods on the proxied object. Previously (given User has_one :account) <tt>@user.account.private_method</tt> would call the private method on the associated Account object. That fails in Rails 2.2; if you need this functionality, you should use <tt>@user.account.send(:private_method)</tt> (or make the method public instead of private or protected). Please note that if you&#8217;re overriding <tt>method_missing</tt>, you should also override <tt>respond_to</tt> to match the behavior in order for associations to function normally.</p></div>
-<div class="ulist"><ul>
-<li>
-<p>
-Lead Contributor: Adam Milligan
-</p>
-</li>
-<li>
-<p>
-More information:
-</p>
-<div class="ulist"><ul>
-<li>
-<p>
-<a href="http://afreshcup.com/2008/10/24/rails-22-change-private-methods-on-association-proxies-are-private/">Rails 2.2 Change: Private Methods on Association Proxies are Private</a>
-</p>
-</li>
-</ul></div>
-</li>
-</ul></div>
-<h3 id="_other_activerecord_changes">5.6. Other ActiveRecord Changes</h3>
-<div class="ulist"><ul>
-<li>
-<p>
-<tt>rake db:migrate:redo</tt> now accepts an optional VERSION to target that specific migration to redo
-</p>
-</li>
-<li>
-<p>
-Set <tt>config.active_record.timestamped_migrations = false</tt> to have migrations with numeric prefix instead of UTC timestamp.
-</p>
-</li>
-<li>
-<p>
-Counter cache columns (for associations declared with <tt>:counter_cache =&gt; true</tt>) do not need to be initialized to zero any longer.
-</p>
-</li>
-<li>
-<p>
-<tt>ActiveRecord::Base.human_name</tt> for an internationalization-aware humane translation of model names
-</p>
-</li>
-</ul></div>
-</div>
-<h2 id="_action_controller">6. Action Controller</h2>
-<div class="sectionbody">
-<div class="paragraph"><p>On the controller side, there are several changes that will help tidy up your routes. There are also some internal changes in the routing engine to lower memory usage on complex applications.</p></div>
-<h3 id="_shallow_route_nesting">6.1. Shallow Route Nesting</h3>
-<div class="paragraph"><p>Shallow route nesting provides a solution to the well-known difficulty of using deeply-nested resources. With shallow nesting, you need only supply enough information to uniquely identify the resource that you want to work with.</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt>map<span style="color: #990000">.</span>resources <span style="color: #990000">:</span>publishers<span style="color: #990000">,</span> <span style="color: #990000">:</span>shallow <span style="color: #990000">=&gt;</span> <span style="font-weight: bold"><span style="color: #0000FF">true</span></span> <span style="font-weight: bold"><span style="color: #0000FF">do</span></span> <span style="color: #990000">|</span>publisher<span style="color: #990000">|</span>
- publisher<span style="color: #990000">.</span>resources <span style="color: #990000">:</span>magazines <span style="font-weight: bold"><span style="color: #0000FF">do</span></span> <span style="color: #990000">|</span>magazine<span style="color: #990000">|</span>
- magazine<span style="color: #990000">.</span>resources <span style="color: #990000">:</span>photos
- <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
-<span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
-<div class="paragraph"><p>This will enable recognition of (among others) these routes:</p></div>
-<div class="listingblock">
-<div class="content">
-<pre><tt>/publishers/1 ==&gt; publisher_path(1)
-/publishers/1/magazines ==&gt; publisher_magazines_path(1)
-/magazines/2 ==&gt; magazine_path(2)
-/magazines/2/photos ==&gt; magazines_photos_path(2)
-/photos/3 ==&gt; photo_path(3)</tt></pre>
-</div></div>
-<div class="ulist"><ul>
-<li>
-<p>
-Lead Contributor: <a href="http://www.unwwwired.net/">S. Brent Faulkner</a>
-</p>
-</li>
-<li>
-<p>
-More information:
-</p>
-<div class="ulist"><ul>
-<li>
-<p>
-<a href="http://guides.rails.info/routing/routing_outside_in.html#_nested_resources">Rails Routing from the Outside In</a>
-</p>
-</li>
-<li>
-<p>
-<a href="http://ryandaigle.com/articles/2008/9/7/what-s-new-in-edge-rails-shallow-routes">What&#8217;s New in Edge Rails: Shallow Routes</a>
-</p>
-</li>
-</ul></div>
-</li>
-</ul></div>
-<h3 id="_method_arrays_for_member_or_collection_routes">6.2. Method Arrays for Member or Collection Routes</h3>
-<div class="paragraph"><p>You can now supply an array of methods for new member or collection routes. This removes the annoyance of having to define a route as accepting any verb as soon as you need it to handle more than one. With Rails 2.2, this is a legitimate route declaration:</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt>map<span style="color: #990000">.</span>resources <span style="color: #990000">:</span>photos<span style="color: #990000">,</span> <span style="color: #990000">:</span>collection <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">{</span> <span style="color: #990000">:</span>search <span style="color: #990000">=&gt;</span> <span style="color: #990000">[:</span>get<span style="color: #990000">,</span> <span style="color: #990000">:</span>post<span style="color: #990000">]</span> <span style="color: #FF0000">}</span></tt></pre></div></div>
-<div class="ulist"><ul>
-<li>
-<p>
-Lead Contributor: <a href="http://brennandunn.com/">Brennan Dunn</a>
-</p>
-</li>
-</ul></div>
-<h3 id="_resources_with_specific_actions">6.3. Resources With Specific Actions</h3>
-<div class="paragraph"><p>By default, when you use <tt>map.resources</tt> to create a route, Rails generates routes for seven default actions (index, show, create, new, edit, update, and destroy). But each of these routes takes up memory in your application, and causes Rails to generate additional routing logic. Now you can use the <tt>:only</tt> and <tt>:except</tt> options to fine-tune the routes that Rails will generate for resources. You can supply a single action, an array of actions, or the special <tt>:all</tt> or <tt>:none</tt> options. These options are inherited by nested resources.</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt>map<span style="color: #990000">.</span>resources <span style="color: #990000">:</span>photos<span style="color: #990000">,</span> <span style="color: #990000">:</span>only <span style="color: #990000">=&gt;</span> <span style="color: #990000">[:</span>index<span style="color: #990000">,</span> <span style="color: #990000">:</span>show<span style="color: #990000">]</span>
-map<span style="color: #990000">.</span>resources <span style="color: #990000">:</span>products<span style="color: #990000">,</span> <span style="color: #990000">:</span>except <span style="color: #990000">=&gt;</span> <span style="color: #990000">:</span>destroy</tt></pre></div></div>
-<div class="ulist"><ul>
-<li>
-<p>
-Lead Contributor: <a href="http://experthuman.com/">Tom Stuart</a>
-</p>
-</li>
-</ul></div>
-<h3 id="_other_action_controller_changes">6.4. Other Action Controller Changes</h3>
-<div class="ulist"><ul>
-<li>
-<p>
-You can now easily <a href="http://m.onkey.org/2008/7/20/rescue-from-dispatching">show a custom error page</a> for exceptions raised while routing a request.
-</p>
-</li>
-<li>
-<p>
-The HTTP Accept header is disabled by default now. You should prefer the use of formatted URLs (such as <tt>/customers/1.xml</tt>) to indicate the format that you want. If you need the Accept headers, you can turn them back on with <tt>config.action_controller.use_accept_header = true</tt>.
-</p>
-</li>
-<li>
-<p>
-Benchmarking numbers are now reported in milliseconds rather than tiny fractions of seconds
-</p>
-</li>
-<li>
-<p>
-Rails now supports HTTP-only cookies (and uses them for sessions), which help mitigate some cross-site scripting risks in newer browsers.
-</p>
-</li>
-<li>
-<p>
-<tt>redirect_to</tt> now fully supports URI schemes (so, for example, you can redirect to a svn+ssh: URI).
-</p>
-</li>
-<li>
-<p>
-<tt>render</tt> now supports a <tt>:js</tt> option to render plain vanilla javascript with the right mime type.
-</p>
-</li>
-<li>
-<p>
-Request forgery protection has been tightened up to apply to HTML-formatted content requests only.
-</p>
-</li>
-<li>
-<p>
-Polymorphic URLs behave more sensibly if a passed parameter is nil. For example, calling <tt>polymorphic_path([@project, @date, @area])</tt> with a nil date will give you <tt>project_area_path</tt>.
-</p>
-</li>
-</ul></div>
-</div>
-<h2 id="_action_view">7. Action View</h2>
-<div class="sectionbody">
-<div class="ulist"><ul>
-<li>
-<p>
-<tt>javascript_include_tag</tt> and <tt>stylesheet_link_tag</tt> support a new <tt>:recursive</tt> option to be used along with <tt>:all</tt>, so that you can load an entire tree of files with a single line of code.
-</p>
-</li>
-<li>
-<p>
-The included Prototype javascript library has been upgraded to version 1.6.0.3.
-</p>
-</li>
-<li>
-<p>
-<tt>RJS#page.reload</tt> to reload the browser&#8217;s current location via javascript
-</p>
-</li>
-<li>
-<p>
-The <tt>atom_feed</tt> helper now takes an <tt>:instruct</tt> option to let you insert XML processing instructions.
-</p>
-</li>
-</ul></div>
-</div>
-<h2 id="_action_mailer">8. Action Mailer</h2>
-<div class="sectionbody">
-<div class="paragraph"><p>Action Mailer now supports mailer layouts. You can make your HTML emails as pretty as your in-browser views by supplying an appropriately-named layout - for example, the <tt>CustomerMailer</tt> class expects to use <tt>layouts/customer_mailer.html.erb</tt>.</p></div>
-<div class="ulist"><ul>
-<li>
-<p>
-More information:
-</p>
-<div class="ulist"><ul>
-<li>
-<p>
-<a href="http://ryandaigle.com/articles/2008/9/7/what-s-new-in-edge-rails-mailer-layouts">What&#8217;s New in Edge Rails: Mailer Layouts</a>
-</p>
-</li>
-</ul></div>
-</li>
-</ul></div>
-<div class="paragraph"><p>Action Mailer now offers built-in support for GMail&#8217;s SMTP servers, by turning on STARTTLS automatically. This requires Ruby 1.8.7 to be installed.</p></div>
-</div>
-<h2 id="_active_support">9. Active Support</h2>
-<div class="sectionbody">
-<div class="paragraph"><p>Active Support now offers built-in memoization for Rails applications, the <tt>each_with_object</tt> method, prefix support on delegates, and various other new utility methods.</p></div>
-<h3 id="_memoization">9.1. Memoization</h3>
-<div class="paragraph"><p>Memoization is a pattern of initializing a method once and then stashing its value away for repeat use. You&#8217;ve probably used this pattern in your own applications:</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">def</span></span> full_name
- <span style="color: #009900">@full_name</span> <span style="color: #990000">||=</span> <span style="color: #FF0000">"#{first_name} #{last_name}"</span>
-<span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
-<div class="paragraph"><p>Memoization lets you handle this task in a declarative fashion:</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt>extend ActiveSupport<span style="color: #990000">::</span>Memoizable
-
-<span style="font-weight: bold"><span style="color: #0000FF">def</span></span> full_name
- <span style="color: #FF0000">"#{first_name} #{last_name}"</span>
-<span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
-memoize <span style="color: #990000">:</span>full_name</tt></pre></div></div>
-<div class="paragraph"><p>Other features of memoization include <tt>unmemoize</tt>, <tt>unmemoize_all</tt>, and <tt>memoize_all</tt> to turn memoization on or off.</p></div>
-<div class="ulist"><ul>
-<li>
-<p>
-Lead Contributor: <a href="http://joshpeek.com/">Josh Peek</a>
-</p>
-</li>
-<li>
-<p>
-More information:
-</p>
-<div class="ulist"><ul>
-<li>
-<p>
-<a href="http://ryandaigle.com/articles/2008/7/16/what-s-new-in-edge-rails-memoization">What&#8217;s New in Edge Rails: Easy Memoization</a>
-</p>
-</li>
-<li>
-<p>
-<a href="http://www.railway.at/articles/2008/09/20/a-guide-to-memoization">Memo-what? A Guide to Memoization</a>
-</p>
-</li>
-</ul></div>
-</li>
-</ul></div>
-<h3 id="_tt_each_with_object_tt">9.2. <tt>each_with_object</tt></h3>
-<div class="paragraph"><p>The <tt>each_with_object</tt> method provides an alternative to <tt>inject</tt>, using a method backported from Ruby 1.9. It iterates over a collection, passing the current element and the memo into the block.</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="color: #990000">%</span>w<span style="color: #990000">(</span>foo bar<span style="color: #990000">).</span>each_with_object<span style="color: #990000">(</span><span style="color: #FF0000">{}</span><span style="color: #990000">)</span> <span style="color: #FF0000">{</span> <span style="color: #990000">|</span>str<span style="color: #990000">,</span> hsh<span style="color: #990000">|</span> hsh<span style="color: #990000">[</span>str<span style="color: #990000">]</span> <span style="color: #990000">=</span> str<span style="color: #990000">.</span>upcase <span style="color: #FF0000">}</span> <span style="font-style: italic"><span style="color: #9A1900">#=&gt; {'foo' =&gt; 'FOO', 'bar' =&gt; 'BAR'}</span></span></tt></pre></div></div>
-<div class="paragraph"><p>Lead Contributor: <a href="http://therealadam.com/">Adam Keys</a></p></div>
-<h3 id="_delegates_with_prefixes">9.3. Delegates With Prefixes</h3>
-<div class="paragraph"><p>If you delegate behavior from one class to another, you can now specify a prefix that will be used to identify the delegated methods. For example:</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">class</span></span> Vendor <span style="color: #990000">&lt;</span> ActiveRecord<span style="color: #990000">::</span>Base
- has_one <span style="color: #990000">:</span>account
- delegate <span style="color: #990000">:</span>email<span style="color: #990000">,</span> <span style="color: #990000">:</span>password<span style="color: #990000">,</span> <span style="color: #990000">:</span>to <span style="color: #990000">=&gt;</span> <span style="color: #990000">:</span>account<span style="color: #990000">,</span> <span style="color: #990000">:</span>prefix <span style="color: #990000">=&gt;</span> <span style="font-weight: bold"><span style="color: #0000FF">true</span></span>
-<span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
-<div class="paragraph"><p>This will produce delegated methods <tt>vendor#account_email</tt> and <tt>vendor#account_password</tt>. You can also specify a custom prefix:</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">class</span></span> Vendor <span style="color: #990000">&lt;</span> ActiveRecord<span style="color: #990000">::</span>Base
- has_one <span style="color: #990000">:</span>account
- delegate <span style="color: #990000">:</span>email<span style="color: #990000">,</span> <span style="color: #990000">:</span>password<span style="color: #990000">,</span> <span style="color: #990000">:</span>to <span style="color: #990000">=&gt;</span> <span style="color: #990000">:</span>account<span style="color: #990000">,</span> <span style="color: #990000">:</span>prefix <span style="color: #990000">=&gt;</span> <span style="color: #990000">:</span>owner
-<span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
-<div class="paragraph"><p>This will produce delegated methods <tt>vendor#owner_email</tt> and <tt>vendor#owner_password</tt>.</p></div>
-<div class="paragraph"><p>Lead Contributor: <a href="http://workingwithrails.com/person/5830-daniel-schierbeck">Daniel Schierbeck</a></p></div>
-<h3 id="_other_active_support_changes">9.4. Other Active Support Changes</h3>
-<div class="ulist"><ul>
-<li>
-<p>
-Extensive updates to <tt>ActiveSupport::Multibyte</tt>, including Ruby 1.9 compatibility fixes.
-</p>
-</li>
-<li>
-<p>
-The addition of <tt>ActiveSupport::Rescuable</tt> allows any class to mix in the <tt>rescue_from</tt> syntax.
-</p>
-</li>
-<li>
-<p>
-<tt>past?</tt>, <tt>today?</tt> and <tt>future?</tt> for <tt>Date</tt> and <tt>Time</tt> classes to facilitate date/time comparisons.
-</p>
-</li>
-<li>
-<p>
-<tt>Array#second</tt> through <tt>Array#fifth</tt> as aliases for <tt>Array#[1]</tt> through <tt>Array#[4]</tt>
-</p>
-</li>
-<li>
-<p>
-<tt>Enumerable#many?</tt> to encapsulate <tt>collection.size &gt; 1</tt>
-</p>
-</li>
-<li>
-<p>
-<tt>Inflector#parameterize</tt> produces a URL-ready version of its input, for use in <tt>to_param</tt>.
-</p>
-</li>
-<li>
-<p>
-<tt>Time#advance</tt> recognizes fractional days and weeks, so you can do <tt>1.7.weeks.ago</tt>, <tt>1.5.hours.since</tt>, and so on.
-</p>
-</li>
-<li>
-<p>
-The included TzInfo library has been upgraded to version 0.3.12.
-</p>
-</li>
-<li>
-<p>
-<tt>ActiveSuport::StringInquirer</tt> gives you a pretty way to test for equality in strings: <tt>ActiveSupport::StringInquirer.new("abc").abc? =&gt; true</tt>
-</p>
-</li>
-</ul></div>
-</div>
-<h2 id="_railties">10. Railties</h2>
-<div class="sectionbody">
-<div class="paragraph"><p>In Railties (the core code of Rails itself) the biggest changes are in the <tt>config.gems</tt> mechanism.</p></div>
-<h3 id="_tt_config_gems_tt">10.1. <tt>config.gems</tt></h3>
-<div class="paragraph"><p>To avoid deployment issues and make Rails applications more self-contained, it&#8217;s possible to place copies of all of the gems that your Rails application requires in <tt>/vendor/gems</tt>. This capability first appeared in Rails 2.1, but it&#8217;s much more flexible and robust in Rails 2.2, handling complicated dependencies between gems. Gem management in Rails includes these commands:</p></div>
-<div class="ulist"><ul>
-<li>
-<p>
-<tt>config.gem <em>gem_name</em></tt> in your <tt>config/environment.rb</tt> file
-</p>
-</li>
-<li>
-<p>
-<tt>rake gems</tt> 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)
-</p>
-</li>
-<li>
-<p>
-<tt>rake gems:install</tt> to install missing gems to the computer
-</p>
-</li>
-<li>
-<p>
-<tt>rake gems:unpack</tt> to place a copy of the required gems into <tt>/vendor/gems</tt>
-</p>
-</li>
-<li>
-<p>
-<tt>rake gems:unpack:dependencies</tt> to get copies of the required gems and their dependencies into <tt>/vendor/gems</tt>
-</p>
-</li>
-<li>
-<p>
-<tt>rake gems:build</tt> to build any missing native extensions
-</p>
-</li>
-<li>
-<p>
-<tt>rake gems:refresh_specs</tt> to bring vendored gems created with Rails 2.1 into alignment with the Rails 2.2 way of storing them
-</p>
-</li>
-</ul></div>
-<div class="paragraph"><p>You can unpack or install a single gem by specifying <tt>GEM=<em>gem_name</em></tt> on the command line.</p></div>
-<div class="ulist"><ul>
-<li>
-<p>
-Lead Contributor: <a href="http://github.com/al2o3cr">Matt Jones</a>
-</p>
-</li>
-<li>
-<p>
-More information:
-</p>
-<div class="ulist"><ul>
-<li>
-<p>
-<a href="http://ryandaigle.com/articles/2008/4/1/what-s-new-in-edge-rails-gem-dependencies">What&#8217;s New in Edge Rails: Gem Dependencies</a>
-</p>
-</li>
-<li>
-<p>
-<a href="http://afreshcup.com/2008/10/25/rails-212-and-22rc1-update-your-rubygems/">Rails 2.1.2 and 2.2RC1: Update Your RubyGems</a>
-</p>
-</li>
-<li>
-<p>
-<a href="http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1128">Detailed discussion on Lighthouse</a>
-</p>
-</li>
-</ul></div>
-</li>
-</ul></div>
-<h3 id="_other_railties_changes">10.2. Other Railties Changes</h3>
-<div class="ulist"><ul>
-<li>
-<p>
-If you&#8217;re a fan of the <a href="http://code.macournoyer.com/thin/">Thin</a> web server, you&#8217;ll be happy to know that <tt>script/server</tt> now supports Thin directly.
-</p>
-</li>
-<li>
-<p>
-<tt>script/plugin install &lt;plugin&gt; -r &lt;revision&gt;</tt> now works with git-based as well as svn-based plugins.
-</p>
-</li>
-<li>
-<p>
-<tt>script/console</tt> now supports a <tt>--debugger</tt> option
-</p>
-</li>
-<li>
-<p>
-Instructions for setting up a continuous integration server to build Rails itself are included in the Rails source
-</p>
-</li>
-<li>
-<p>
-<tt>rake notes:custom ANNOTATION=MYFLAG</tt> lets you list out custom annotations.
-</p>
-</li>
-<li>
-<p>
-Wrapped <tt>Rails.env</tt> in <tt>StringInquirer</tt> so you can do <tt>Rails.env.development?</tt>
-</p>
-</li>
-<li>
-<p>
-To eliminate deprecation warnings and properly handle gem dependencies, Rails now requires rubygems 1.3.1 or higher.
-</p>
-</li>
-</ul></div>
-</div>
-<h2 id="_deprecated">11. Deprecated</h2>
-<div class="sectionbody">
-<div class="paragraph"><p>A few pieces of older code are deprecated in this release:</p></div>
-<div class="ulist"><ul>
-<li>
-<p>
-<tt>Rails::SecretKeyGenerator</tt> has been replaced by <tt>ActiveSupport::SecureRandom</tt>
-</p>
-</li>
-<li>
-<p>
-<tt>render_component</tt> is deprecated. There&#8217;s a <a href="http://github.com/rails/render_component/tree/master">render_components plugin</a> available if you need this functionality.
-</p>
-</li>
-<li>
-<p>
-Implicit local assignments when rendering partials has been deprecated.
-</p>
-</li>
-</ul></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">def</span></span> partial_with_implicit_local_assignment
- <span style="color: #009900">@customer</span> <span style="color: #990000">=</span> Customer<span style="color: #990000">.</span>new<span style="color: #990000">(</span><span style="color: #FF0000">"Marcel"</span><span style="color: #990000">)</span>
- render <span style="color: #990000">:</span>partial <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"customer"</span>
-<span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
-<div class="paragraph"><p>Previously the above code made available a local variable called <tt>customer</tt> inside the partial <em>customer</em>. You should explicitly pass all the variables via :locals hash now.</p></div>
-<div class="ulist"><ul>
-<li>
-<p>
-<tt>country_select</tt> has been removed. See the <a href="http://www.rubyonrails.org/deprecation/list-of-countries">deprecation page</a> for more information and a plugin replacement.
-</p>
-</li>
-<li>
-<p>
-<tt>ActiveRecord::Base.allow_concurrency</tt> no longer has any effect.
-</p>
-</li>
-<li>
-<p>
-<tt>ActiveRecord::Errors.default_error_messages</tt> has been deprecated in favor of <tt>I18n.translate(<em>activerecord.errors.messages</em>)</tt>
-</p>
-</li>
-<li>
-<p>
-The <tt>%s</tt> and <tt>%d</tt> interpolation syntax for internationalization is deprecated.
-</p>
-</li>
-<li>
-<p>
-<tt>String#chars</tt> has been deprecated in favor of <tt>String#mb_chars</tt>.
-</p>
-</li>
-<li>
-<p>
-Durations of fractional months or fractional years are deprecated. Use Ruby&#8217;s core <tt>Date</tt> and <tt>Time</tt> class arithmetic instead.
-</p>
-</li>
-<li>
-<p>
-<tt>Request#relative_url_root</tt> is deprecated. Use <tt>ActionController::Base.relative_url_root</tt> instead.
-</p>
-</li>
-</ul></div>
-</div>
-<h2 id="_credits">12. Credits</h2>
-<div class="sectionbody">
-<div class="paragraph"><p>Release notes compiled by <a href="http://afreshcup.com">Mike Gunderloy</a></p></div>
-</div>
-
- </div>
- </div>
-</body>
-</html>
1,033 railties/doc/guides/html/2_3_release_notes.html
View
@@ -1,1033 +0,0 @@
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
- <title>Ruby on Rails 2.3 Release Notes</title>
- <!--[if lt IE 8]>
- <script src="http://ie7-js.googlecode.com/svn/version/2.0(beta3)/IE8.js" type="text/javascript"></script>
- <![endif]-->
- <link href="stylesheets/base.css" media="screen" rel="Stylesheet" type="text/css" />
- <link href="stylesheets/forms.css" media="screen" rel="Stylesheet" type="text/css" />
- <link href="stylesheets/more.css" media="screen" rel="Stylesheet" type="text/css" />
-</head>
-<body>
- <div id="header" >
- <div id="logo">
- <a href="index.html" title="Ruby on Rails"><img src="images/rails_logo_remix.gif" alt="Rails" height="140" width="110" /></a>
- </div>
-
- <h1 id="site_title"><span>Ruby on Rails</span></h1>
- <h2 id="site_title_tagline">Sustainable productivity for web-application development</h2>
-
- <ul id="navMain">
- <li class="first-child"><a href="http://www.rubyonrails.org/" title="Ruby on Rails" class="ruby_on_rails">Ruby on Rails</a></li>
- <li><a class="manuals" href="index.html" title="Manuals Index">Guides Index</a></li>
- </ul>
- </div>
-
- <div id="container">
-
- <div id="sidebar">
- <h2>Chapters</h2>
- <ol>
- <li>
- <a href="#_application_architecture">Application Architecture</a>
- <ul>
-
- <li><a href="#_rack_integration">Rack Integration</a></li>
-
- <li><a href="#_renewed_support_for_rails_engines">Renewed Support for Rails Engines</a></li>
-
- </ul>
- </li>
- <li>
- <a href="#_documentation">Documentation</a>
- </li>
- <li>
- <a href="#_active_record">Active Record</a>
- <ul>
-
- <li><a href="#_nested_attributes">Nested Attributes</a></li>
-
- <li><a href="#_nested_transactions">Nested Transactions</a></li>
-
- <li><a href="#_dynamic_scopes">Dynamic Scopes</a></li>
-
- <li><a href="#_default_scopes">Default Scopes</a></li>
-
- <li><a href="#_multiple_conditions_for_callbacks">Multiple Conditions for Callbacks</a></li>
-
- <li><a href="#_find_with_having">Find with having</a></li>
-
- <li><a href="#_hash_conditions_for_tt_has_many_tt_relationships">Hash Conditions for <tt>has_many</tt> relationships</a></li>
-
- <li><a href="#_reconnecting_mysql_connections">Reconnecting MySQL Connections</a></li>
-
- <li><a href="#_other_active_record_changes">Other Active Record Changes</a></li>
-
- </ul>
- </li>
- <li>
- <a href="#_action_controller">Action Controller</a>
- <ul>
-
- <li><a href="#_unified_rendering">Unified Rendering</a></li>
-
- <li><a href="#_application_controller_renamed">Application Controller Renamed</a></li>
-
- <li><a href="#_http_digest_authentication_support">HTTP Digest Authentication Support</a></li>
-
- <li><a href="#_more_efficient_routing">More Efficient Routing</a></li>
-
- <li><a href="#_rack_based_lazy_loaded_sessions">Rack-based Lazy-loaded Sessions</a></li>
-
- <li><a href="#_mime_type_handling_changes">MIME Type Handling Changes</a></li>
-
- <li><a href="#_optimization_of_tt_respond_to_tt">Optimization of <tt>respond_to</tt></a></li>
-
- <li><a href="#_improved_caching_performance">Improved Caching Performance</a></li>
-
- <li><a href="#_localized_views">Localized Views</a></li>
-
- <li><a href="#_other_action_controller_changes">Other Action Controller Changes</a></li>
-
- </ul>
- </li>
- <li>
- <a href="#_action_view">Action View</a>
- <ul>
-
- <li><a href="#_nested_object_forms">Nested Object Forms</a></li>
-
- <li><a href="#_smart_rendering_of_partials">Smart Rendering of Partials</a></li>
-
- <li><a href="#_prompts_for_date_select_helpers">Prompts for Date Select Helpers</a></li>
-
- <li><a href="#_assettag_timestamp_caching">AssetTag Timestamp Caching</a></li>
-
- <li><a href="#_asset_hosts_as_objects">Asset Hosts as Objects</a></li>
-
- <li><a href="#_grouped_options_for_select_helper_method">grouped_options_for_select Helper Method</a></li>
-
- <li><a href="#_other_action_view_changes">Other Action View Changes</a></li>
-
- </ul>
- </li>
- <li>
- <a href="#_active_support">Active Support</a>
- <ul>
-
- <li><a href="#_object_try">Object#try</a></li>
-
- <li><a href="#_object_tap_backport">Object#tap Backport</a></li>
-
- <li><a href="#_fractional_seconds_for_timewithzone">Fractional seconds for TimeWithZone</a></li>
-
- <li><a href="#_json_key_quoting">JSON Key Quoting</a></li>
-
- <li><a href="#_other_active_support_changes">Other Active Support Changes</a></li>
-
- </ul>
- </li>
- <li>
- <a href="#_railties">Railties</a>
- <ul>
-
- <li><a href="#_rails_metal">Rails Metal</a></li>
-
- <li><a href="#_application_templates">Application Templates</a></li>
-
- <li><a href="#_quieter_backtraces">Quieter Backtraces</a></li>
-
- <li><a href="#_faster_boot_time_in_development_mode_with_lazy_loading_autoload">Faster Boot Time in Development Mode with Lazy Loading/Autoload</a></li>
-
- <li><a href="#_other_railties_changes">Other Railties Changes</a></li>
-
- </ul>
- </li>
- <li>
- <a href="#_deprecated">Deprecated</a>
- </li>
- <li>
- <a href="#_credits">Credits</a>
- </li>
- </ol>
- </div>
-
- <div id="content">
- <h1>Ruby on Rails 2.3 Release Notes</h1>
- <div id="preamble">
-<div class="sectionbody">
-<div class="paragraph"><p>Rails 2.3 delivers a variety of new and improved features, including pervasive Rack integration, refreshed support for Rails Engines, nested transactions for Active Record, dynamic and default scopes, unified rendering, more efficient routing, application templates, and quiet backtraces. This list covers the major upgrades, but doesn&#8217;t include every little bug fix and change. If you want to see everything, check out the <a href="http://github.com/rails/rails/commits/master">list of commits</a> in the main Rails repository on GitHub or review the <tt>CHANGELOG</tt> files for the individual Rails components.</p></div>
-</div>
-</div>
-<h2 id="_application_architecture">1. Application Architecture</h2>
-<div class="sectionbody">
-<div class="paragraph"><p>There are two major changes in the architecture of Rails applications: complete integration of the <a href="http://rack.rubyforge.org/">Rack</a> modular web server interface, and renewed support for Rails Engines.</p></div>
-<h3 id="_rack_integration">1.1. Rack Integration</h3>
-<div class="paragraph"><p>Rails has now broken with its CGI past, and uses Rack everywhere. This required and resulted in a tremendous number of internal changes (but if you use CGI, don&#8217;t worry; Rails now supports CGI through a proxy interface.) Still, this is a major change to Rails internals. After upgrading to 2.3, you should test on your local environment and your production environment. Some things to test:</p></div>
-<div class="ulist"><ul>
-<li>
-<p>
-Sessions
-</p>
-</li>
-<li>
-<p>
-Cookies
-</p>
-</li>
-<li>
-<p>
-File uploads
-</p>
-</li>
-<li>
-<p>
-JSON/XML APIs
-</p>
-</li>
-</ul></div>
-<div class="paragraph"><p>Here&#8217;s a summary of the rack-related changes:</p></div>
-<div class="ulist"><ul>
-<li>
-<p>
-<tt>script/server</tt> has been switched to use Rack, which means it supports any Rack compatible server. <tt>script/server</tt> will also pick up a rackup configuration file if one exists. By default, it will look for a <tt>config.ru</tt> file, but you can override this with the <tt>-c</tt> switch.
-</p>
-</li>
-<li>
-<p>
-The FCGI handler goes through Rack
-</p>
-</li>
-<li>
-<p>
-<tt>ActionController::Dispatcher</tt> maintains its own default middleware stack. Middlewares can be injected in, reordered, and removed. The stack is compiled into a chain on boot. You can configure the middleware stack in <tt>environment.rb</tt>
-</p>
-</li>
-<li>
-<p>
-The <tt>rake middleware</tt> task has been added to inspect the middleware stack. This is useful for debugging the order of the middleware stack.
-</p>
-</li>
-<li>
-<p>
-The integration test runner has been modified to execute the entire middleware and application stack. This makes integration tests perfect for testing Rack middleware.
-</p>
-</li>
-<li>
-<p>
-<tt>ActionController::CGIHandler</tt> is a backwards compatible CGI wrapper around Rack. The <tt>CGIHandler</tt> is meant to take an old CGI object and converts its environment information into a Rack compatible form.
-</p>
-</li>
-<li>
-<p>
-<tt>CgiRequest</tt> and <tt>CgiResponse</tt> have been removed
-</p>
-</li>
-<li>
-<p>
-Session stores are now lazy loaded. If you never access the session object during a request, it will never attempt to load the session data (parse the cookie, load the data from memcache, or lookup an Active Record object).
-</p>
-</li>
-<li>
-<p>
-<tt>CGI::Session::CookieStore</tt> has been replaced by <tt>ActionController::Session::CookieStore</tt>
-</p>
-</li>
-<li>
-<p>
-<tt>CGI::Session::MemCacheStore</tt> has been replaced by <tt>ActionController::Session::MemCacheStore</tt>
-</p>
-</li>
-<li>
-<p>
-<tt>CGI::Session::ActiveRecordStore</tt> has been replaced by <tt>ActiveRecord::SessionStore</tt>
-</p>
-</li>
-<li>
-<p>
-You can still change your session store with <tt>ActionController::Base.session_store = :active_record_store</tt>
-</p>
-</li>
-<li>
-<p>
-Default sessions options are still set with <tt>ActionController::Base.session = { :key =&gt; "..." }</tt>
-</p>
-</li>
-<li>
-<p>
-The mutex that normally wraps your entire request has been moved into middleware, <tt>ActionController::Lock</tt>
-</p>
-</li>
-<li>
-<p>
-<tt>ActionController::AbstractRequest</tt> and <tt>ActionController::Request</tt> have been unified. The new <tt>ActionController::Request</tt> inherits from <tt>Rack::Request</tt>. This affects access to <tt>response.headers[<em>type</em>]</tt> in test requests. Use <tt>response.content_type</tt> instead.
-</p>
-</li>
-<li>
-<p>
-<tt>ActiveRecord::QueryCache</tt> middleware is automatically inserted onto the middleware stack if <tt>ActiveRecord</tt> has been loaded. This middleware sets up and flushes the per-request Active Record query cache.
-</p>
-</li>
-<li>
-<p>
-The Rails router and controller classes follow the Rack spec. You can call a controller directly with <tt>SomeController.call(env)</tt>. The router stores the routing parameters in <tt>rack.routing_args</tt>.
-</p>
-</li>
-<li>
-<p>
-<tt>ActionController::Request</tt> inherits from <tt>Rack::Request</tt>
-</p>
-</li>
-<li>
-<p>
-Instead of <tt>config.action_controller.session = { :session_key =&gt; <em>foo</em>, ...</tt> use <tt>config.action_controller.session = { :key =&gt; <em>foo</em>, ...</tt>
-</p>
-</li>
-<li>
-<p>
-Using the <tt>ParamsParser</tt> middleware preprocesses any XML, JSON, or YAML requests so they can be read normally with any <tt>Rack::Request</tt> object after it.
-</p>
-</li>
-</ul></div>
-<h3 id="_renewed_support_for_rails_engines">1.2. Renewed Support for Rails Engines</h3>
-<div class="paragraph"><p>After some versions without an upgrade, Rails 2.3 offers some new features for Rails Engines (Rails applications that can be embedded within other applications). First, routing files in engines are automatically loaded and reloaded now, just like your <tt>routes.rb</tt> file (this also applies to routing files in other plugins). Second, if your plugin has an app folder, then app/[models|controllers|helpers] will automatically be added to the Rails load path. Engines also support adding view paths now.</p></div>
-</div>
-<h2 id="_documentation">2. Documentation</h2>
-<div class="sectionbody">
-<div class="paragraph"><p>The <a href="http://guides.rubyonrails.org/">Ruby on Rails guides</a> project has published several additional guides for Rails 2.3. In addition, a <a href="http://guides.rails.info/">separate site</a> maintains updated copies of the Guides for Edge Rails. Other documentation efforts include a relaunch of the <a href="http://newwiki.rubyonrails.org/">Rails wiki</a> and early planning for a Rails Book.</p></div>
-<div class="ulist"><ul>
-<li>
-<p>
-More Information: <a href="http://weblog.rubyonrails.org/2009/1/15/rails-documentation-projects">Rails Documentation Projects</a>
-</p>
-</li>
-</ul></div>
-</div>
-<h2 id="_active_record">3. Active Record</h2>
-<div class="sectionbody">
-<div class="paragraph"><p>Active Record gets quite a number of new features and bug fixes in Rails 2.3. The highlights include nested attributes, nested transactions, dynamic scopes, and default scopes.</p></div>
-<h3 id="_nested_attributes">3.1. Nested Attributes</h3>
-<div class="paragraph"><p>Active Record can now update the attributes on nested models directly, provided you tell it to do so:</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">class</span></span> Book <span style="color: #990000">&lt;</span> ActiveRecord<span style="color: #990000">::</span>Base
- has_one <span style="color: #990000">:</span>author
- has_many <span style="color: #990000">:</span>pages
-
- accepts_nested_attributes_for <span style="color: #990000">:</span>author<span style="color: #990000">,</span> <span style="color: #990000">:</span>pages
-<span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
-<div class="paragraph"><p>Turning on nested attributes enables a number of things: automatic (and atomic) saving of a record together with its associated children, child-aware validations, and support for nested forms (discussed later).</p></div>
-<div class="ulist"><ul>
-<li>
-<p>
-Lead Contributor: link_to:<a href="http://www.superalloy.nl/blog/">Eloy Duran</a>
-</p>
-</li>
-<li>
-<p>
-More Information: link_to:<a href="http://weblog.rubyonrails.org/2009/1/26/nested-model-forms">Nested Model Forms</a>
-</p>
-</li>
-</ul></div>
-<h3 id="_nested_transactions">3.2. Nested Transactions</h3>
-<div class="paragraph"><p>Active Record now supports nested transactions, a much-requested feature. Now you can write code like this:</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt>User<span style="color: #990000">.</span>transaction <span style="font-weight: bold"><span style="color: #0000FF">do</span></span>
- User<span style="color: #990000">.</span>create<span style="color: #990000">(:</span>username <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">'Admin'</span><span style="color: #990000">)</span>
- User<span style="color: #990000">.</span>transaction<span style="color: #990000">(:</span>requires_new <span style="color: #990000">=&gt;</span> <span style="font-weight: bold"><span style="color: #0000FF">true</span></span><span style="color: #990000">)</span> <span style="font-weight: bold"><span style="color: #0000FF">do</span></span>
- User<span style="color: #990000">.</span>create<span style="color: #990000">(:</span>username <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">'Regular'</span><span style="color: #990000">)</span>
- <span style="font-weight: bold"><span style="color: #0000FF">raise</span></span> ActiveRecord<span style="color: #990000">::</span>Rollback
- <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
- <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
-
- User<span style="color: #990000">.</span>find<span style="color: #990000">(:</span>all<span style="color: #990000">)</span> <span style="font-style: italic"><span style="color: #9A1900"># =&gt; Returns only Admin</span></span></tt></pre></div></div>
-<div class="paragraph"><p>Nested transactions let you roll back an inner transaction without affecting the state of the outer transaction. If you want a transaction to be nested, you must explicitly add the <tt>:requires_new</tt> option; otherwise, a nested transaction simply becomes part of the parent transaction (as it does currently on Rails 2.2). Under the covers, nested transactions are <a href="http://rails.lighthouseapp.com/projects/8994/tickets/383">using savepoints</a>, so they&#8217;re supported even on databases that don&#8217;t have true nested transactions. There is also a bit of magic going on to make these transactions play well with transactional fixtures during testing.</p></div>
-<div class="ulist"><ul>
-<li>
-<p>
-Lead Contributors: <a href="http://www.workingwithrails.com/person/4985-jonathan-viney">Jonathan Viney</a> and <a href="http://izumi.plan99.net/blog/">Hongli Lai</a>
-</p>
-</li>
-</ul></div>
-<h3 id="_dynamic_scopes">3.3. Dynamic Scopes</h3>
-<div class="paragraph"><p>You know about dynamic finders in Rails (which allow you to concoct methods like <tt>find_by_color_and_flavor</tt> on the fly) and named scopes (which allow you to encapsulate reusable query conditions into friendly names like <tt>currently_active</tt>). Well, now you can have dynamic scope methods. The idea is to put together syntax that allows filtering on the fly <em>and</em> method chaining. For example:</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt>Order<span style="color: #990000">.</span>scoped_by_customer_id<span style="color: #990000">(</span><span style="color: #993399">12</span><span style="color: #990000">)</span>
-Order<span style="color: #990000">.</span>scoped_by_customer_id<span style="color: #990000">(</span><span style="color: #993399">12</span><span style="color: #990000">).</span>find<span style="color: #990000">(:</span>all<span style="color: #990000">,</span>
- <span style="color: #990000">:</span>conditions <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"status = 'open'"</span><span style="color: #990000">)</span>
-Order<span style="color: #990000">.</span>scoped_by_customer_id<span style="color: #990000">(</span><span style="color: #993399">12</span><span style="color: #990000">).</span>scoped_by_status<span style="color: #990000">(</span><span style="color: #FF0000">"open"</span><span style="color: #990000">)</span></tt></pre></div></div>
-<div class="paragraph"><p>There&#8217;s nothing to define to use dynamic scopes: they just work.</p></div>
-<div class="ulist"><ul>
-<li>
-<p>
-Lead Contributor: <a href="http://evilmartians.com/">Yaroslav Markin</a>
-</p>
-</li>
-<li>
-<p>
-More Information: <a href="http://ryandaigle.com/articles/2008/12/29/what-s-new-in-edge-rails-dynamic-scope-methods">What&#8217;s New in Edge Rails: Dynamic Scope Methods</a>.
-</p>
-</li>
-</ul></div>
-<h3 id="_default_scopes">3.4. Default Scopes</h3>
-<div class="paragraph"><p>Rails 2.3 will introduce the notion of <em>default scopes</em> similar to named scopes, but applying to all named scopes or find methods within the model. For example, you can write <tt>default_scope :order =&gt; <em>name ASC</em></tt> and any time you retrieve records from that model they&#8217;ll come out sorted by name (unless you override the option, of course).</p></div>
-<div class="ulist"><ul>
-<li>
-<p>
-Lead Contributor: Paweł Kondzior
-</p>
-</li>
-<li>
-<p>
-More Information: <a href="http://ryandaigle.com/articles/2008/11/18/what-s-new-in-edge-rails-default-scoping">What&#8217;s New in Edge Rails: Default Scoping</a>
-</p>
-</li>
-</ul></div>
-<h3 id="_multiple_conditions_for_callbacks">3.5. Multiple Conditions for Callbacks</h3>
-<div class="paragraph"><p>When using Active Record callbacks, you can now combine <tt>:if</tt> and <tt>:unless</tt> options on the same callback, and supply multiple conditions as an array:</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt>before_save <span style="color: #990000">:</span>update_credit_rating<span style="color: #990000">,</span> <span style="color: #990000">:</span><span style="font-weight: bold"><span style="color: #0000FF">if</span></span> <span style="color: #990000">=&gt;</span> <span style="color: #990000">:</span>active<span style="color: #990000">,</span>
- <span style="color: #990000">:</span><span style="font-weight: bold"><span style="color: #0000FF">unless</span></span> <span style="color: #990000">=&gt;</span> <span style="color: #990000">[:</span>admin<span style="color: #990000">,</span> <span style="color: #990000">:</span>cash_only<span style="color: #990000">]</span></tt></pre></div></div>
-<div class="ulist"><ul>
-<li>
-<p>
-Lead Contributor: L. Caviola
-</p>
-</li>
-</ul></div>
-<h3 id="_find_with_having">3.6. Find with having</h3>
-<div class="paragraph"><p>Rails now has a <tt>:having</tt> option on find (as well as on <tt>has_many</tt> and <tt>has_and_belongs_to_many</tt> associations) for filtering records in grouped finds. As those with heavy SQL backgrounds know, this allows filtering based on grouped results:</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt>developers <span style="color: #990000">=</span> Developer<span style="color: #990000">.</span>find<span style="color: #990000">(:</span>all<span style="color: #990000">,</span> <span style="color: #990000">:</span>group <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"salary"</span><span style="color: #990000">,</span>
- <span style="color: #990000">:</span>having <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"sum(salary) &gt; 10000"</span><span style="color: #990000">,</span> <span style="color: #990000">:</span>select <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"salary"</span><span style="color: #990000">)</span></tt></pre></div></div>
-<div class="ulist"><ul>
-<li>
-<p>
-Lead Contributor: <a href="http://github.com/miloops">Emilio Tagua</a>
-</p>
-</li>
-</ul></div>
-<h3 id="_hash_conditions_for_tt_has_many_tt_relationships">3.7. Hash Conditions for <tt>has_many</tt> relationships</h3>
-<div class="paragraph"><p>You can once again use a hash in conditions for a <tt>has_many</tt> relationship:</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt>has_many <span style="color: #990000">:</span>orders<span style="color: #990000">,</span> <span style="color: #990000">:</span>conditions <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">{</span><span style="color: #990000">:</span>status <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">'confirmed'</span><span style="color: #FF0000">}</span></tt></pre></div></div>
-<div class="paragraph"><p>That worked in Rails 2.1, fails in Rails 2.2, and will now work again in Rails 2.3 (if you&#8217;re dealing with this issue in Rails 2.2, you can use a string rather than a hash to specify conditions).</p></div>
-<div class="ulist"><ul>
-<li>
-<p>
-Lead Contributor: <a href="http://www.spacevatican.org/">Frederick Cheung</a>
-</p>
-</li>
-</ul></div>
-<h3 id="_reconnecting_mysql_connections">3.8. Reconnecting MySQL Connections</h3>
-<div class="paragraph"><p>MySQL supports a reconnect flag in its connections - if set to true, then the client will try reconnecting to the server before giving up in case of a lost connection. You can now set <tt>reconnect = true</tt> for your MySQL connections in <tt>database.yml</tt> to get this behavior from a Rails application. The default is <tt>false</tt>, so the behavior of existing applications doesn&#8217;t change.</p></div>
-<div class="ulist"><ul>
-<li>
-<p>
-Lead Contributor: <a href="http://twitter.com/dubek">Dov Murik</a>
-</p>
-</li>
-<li>
-<p>
-More information:
-</p>
-<div class="ulist"><ul>
-<li>
-<p>
-<a href="http://dev.mysql.com/doc/refman/5.0/en/auto-reconnect.html">Controlling Automatic Reconnection Behavior</a>
-</p>
-</li>
-<li>
-<p>
-<a href="http://groups.google.com/group/rubyonrails-core/browse_thread/thread/49d2a7e9c96cb9f4">MySQL auto-reconnect revisited</a>
-</p>
-</li>
-</ul></div>
-</li>
-</ul></div>
-<h3 id="_other_active_record_changes">3.9. Other Active Record Changes</h3>
-<div class="ulist"><ul>
-<li>
-<p>
-An extra <tt>AS</tt> was removed from the generated SQL for has_and_belongs_to_many preloading, making it work better for some databases.
-</p>
-</li>
-<li>
-<p>
-<tt>ActiveRecord::Base#new_record?</tt> now returns false rather than nil when confronted with an existing record.
-</p>
-</li>
-<li>
-<p>
-A bug in quoting table names in some <tt>has_many :through</tt> associations was fixed.
-</p>
-</li>
-<li>
-<p>
-You can now specify a particular timestamp for <tt>updated_at</tt> timestamps: <tt>cust = Customer.create(:name =&gt; "ABC Industries", :updated_at =&gt; 1.day.ago)</tt>
-</p>
-</li>
-<li>
-<p>
-Better error messages on failed <tt>find_by_attribute!</tt> calls.
-</p>
-</li>
-<li>
-<p>
-Active Record&#8217;s <tt>to_xml</tt> support gets just a little bit more flexible with the addition of a <tt>:camelize</tt> option.
-</p>
-</li>
-<li>
-<p>
-A bug in canceling callbacks from <tt>before_update</tt> or +before_create_ was fixed.
-</p>
-</li>
-<li>
-<p>
-Rake tasks for testing databases via JDBC have been added.
-</p>
-</li>
-<li>
-<p>
-<tt>validates_length_of</tt> will use a custom error message with the <tt>:in</tt> or <tt>:within</tt> options (if one is supplied)
-</p>
-</li>
-</ul></div>
-</div>
-<h2 id="_action_controller">4. Action Controller</h2>
-<div class="sectionbody">
-<div class="paragraph"><p>Action Controller rolls out some significant changes to rendering, as well as improvements in routing and other areas, in this release.</p></div>
-<h3 id="_unified_rendering">4.1. Unified Rendering</h3>
-<div class="paragraph"><p><tt>ActionController::Base#render</tt> is a lot smarter about deciding what to render. Now you can just tell it what to render and expect to get the right results. In older versions of Rails, you often need to supply explicit information to render:</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt>render <span style="color: #990000">:</span>file <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">'/tmp/random_file.erb'</span>
-render <span style="color: #990000">:</span>template <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">'other_controller/action'</span>
-render <span style="color: #990000">:</span>action <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">'show'</span></tt></pre></div></div>
-<div class="paragraph"><p>Now in Rails 2.3, you can just supply what you want to render:</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt>render <span style="color: #FF0000">'/tmp/random_file.erb'</span>
-render <span style="color: #FF0000">'other_controller/action'</span>
-render <span style="color: #FF0000">'show'</span>
-render <span style="color: #990000">:</span>show</tt></pre></div></div>
-<div class="paragraph"><p>Rails chooses between file, template, and action depending on whether there is a leading slash, an embedded slash, or no slash at all in what&#8217;s to be rendered. Note that you can also use a symbol instead of a string when rendering an action. Other rendering styles (<tt>:inline</tt>, <tt>:text</tt>, <tt>:update</tt>, <tt>:nothing</tt>, <tt>:json</tt>, <tt>:xml</tt>, <tt>:js</tt>) still require an explicit option.</p></div>
-<h3 id="_application_controller_renamed">4.2. Application Controller Renamed</h3>
-<div class="paragraph"><p>If you&#8217;re one of the people who has always been bothered by the special-case naming of <tt>application.rb</tt>, rejoice! It&#8217;s been reworked to be application_controller.rb in Rails 2.3. In addition, there&#8217;s a new rake task, <tt>rake rails:update:application_controller</tt> to do this automatically for you - and it will be run as part of the normal <tt>rake rails:update</tt> process.</p></div>
-<div class="ulist"><ul>
-<li>
-<p>
-More Information:
-</p>
-<div class="ulist"><ul>
-<li>
-<p>
-<a href="http://afreshcup.com/2008/11/17/rails-2x-the-death-of-applicationrb/">The Death of Application.rb</a>
-</p>
-</li>
-<li>
-<p>
-<a href="http://ryandaigle.com/articles/2008/11/19/what-s-new-in-edge-rails-application-rb-duality-is-no-more">What&#8217;s New in Edge Rails: Application.rb Duality is no More</a>
-</p>
-</li>
-</ul></div>
-</li>
-</ul></div>
-<h3 id="_http_digest_authentication_support">4.3. HTTP Digest Authentication Support</h3>
-<div class="paragraph"><p>Rails now has built-in support for HTTP digest authentication. To use it, you call <tt>authenticate_or_request_with_http_digest</tt> with a block that returns the user’s password (which is then hashed and compared against the transmitted credentials):</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">class</span></span> PostsController <span style="color: #990000">&lt;</span> ApplicationController
- Users <span style="color: #990000">=</span> <span style="color: #FF0000">{</span><span style="color: #FF0000">"dhh"</span> <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"secret"</span><span style="color: #FF0000">}</span>
- before_filter <span style="color: #990000">:</span>authenticate
-
- <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> secret
- render <span style="color: #990000">:</span>text <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"Password Required!"</span>
- <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
-
- private
- <span style="font-weight: bold"><span style="color: #0000FF">def</span></span> authenticate
- realm <span style="color: #990000">=</span> <span style="color: #FF0000">"Application"</span>
- authenticate_or_request_with_http_digest<span style="color: #990000">(</span>realm<span style="color: #990000">)</span> <span style="font-weight: bold"><span style="color: #0000FF">do</span></span> <span style="color: #990000">|</span>name<span style="color: #990000">|</span>
- Users<span style="color: #990000">[</span>name<span style="color: #990000">]</span>
- <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
- <span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
-<span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
-<div class="ulist"><ul>
-<li>
-<p>
-Lead Contributor: <a href="http://www.kellogg-assoc.com/">Gregg Kellogg</a>
-</p>
-</li>
-<li>
-<p>
-More Information: <a href="http://ryandaigle.com/articles/2009/1/30/what-s-new-in-edge-rails-http-digest-authentication">What&#8217;s New in Edge Rails: HTTP Digest Authentication</a>
-</p>
-</li>
-</ul></div>
-<h3 id="_more_efficient_routing">4.4. More Efficient Routing</h3>
-<div class="paragraph"><p>There are a couple of significant routing changes in Rails 2.3. The <tt>formatted_</tt> route helpers are gone, in favor just passing in <tt>:format</tt> as an option. This cuts down the route generation process by 50% for any resource - and can save a substantial amount of memory (up to 100MB on large applications). If your code uses the <tt>formatted_</tt> helpers, it will still work for the time being - but that behavior is deprecated and your application will be more efficient if you rewrite those routes using the new standard. Another big change is that Rails now supports multiple routing files, not just routes.rb. You can use <tt>RouteSet#add_configuration_file</tt> to bring in more routes at any time - without clearing the currently-loaded routes. While this change is most useful for Engines, you can use it in any application that needs to load routes in batches.</p></div>
-<div class="paragraph"><p>Lead Contributors: <a href="http://blog.hungrymachine.com/">Aaron Batalion</a></p></div>
-<h3 id="_rack_based_lazy_loaded_sessions">4.5. Rack-based Lazy-loaded Sessions</h3>
-<div class="paragraph"><p>A big change pushed the underpinnings of Action Controller session storage down to the Rack level. This involved a good deal of work in the code, though it should be completely transparent to your Rails applications (as a bonus, some icky patches around the old CGI session handler got removed). It&#8217;s still significant, though, for one simple reason: non-Rails Rack applications have access to the same session storage handlers (and therefore the same session) as your Rails applications. In addition, sessions are now lazy-loaded (in line with the loading improvements to the rest of the framework). This means that you no longer need to explicitly disable sessions if you don&#8217;t want them; just don&#8217;t refer to them and they won&#8217;t load.</p></div>
-<h3 id="_mime_type_handling_changes">4.6. MIME Type Handling Changes</h3>
-<div class="paragraph"><p>There are a couple of changes to the code for handling MIME types in Rails. First, <tt>MIME::Type</tt> now implements the <tt>=~</tt> operator, making things much cleaner when you need to check for the presence of a type that has synonyms:</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">if</span></span> content_type <span style="color: #990000">&amp;&amp;</span> Mime<span style="color: #990000">::</span>JS <span style="color: #990000">=~</span> content_type
- <span style="font-style: italic"><span style="color: #9A1900"># do something cool</span></span>
-<span style="font-weight: bold"><span style="color: #0000FF">end</span></span>
-
-Mime<span style="color: #990000">::</span>JS <span style="color: #990000">=~</span> <span style="color: #FF0000">"text/javascript"</span> <span style="color: #990000">=&gt;</span> <span style="font-weight: bold"><span style="color: #0000FF">true</span></span>
-Mime<span style="color: #990000">::</span>JS <span style="color: #990000">=~</span> <span style="color: #FF0000">"application/javascript"</span> <span style="color: #990000">=&gt;</span> <span style="font-weight: bold"><span style="color: #0000FF">true</span></span></tt></pre></div></div>
-<div class="paragraph"><p>The other change is that the framework now uses the <tt>Mime::JS</tt> when checking for javascript in various spots, making it handle those alternatives cleanly.</p></div>
-<div class="paragraph"><p>Lead Contributor: <a href="http://www.workingwithrails.com/person/5510-seth-fitzsimmons">Seth Fitzsimmons</a></p></div>
-<h3 id="_optimization_of_tt_respond_to_tt">4.7. Optimization of <tt>respond_to</tt></h3>
-<div class="paragraph"><p>In some of the first fruits of the Rails-Merb team merger, Rails 2.3 includes some optimizations for the <tt>respond_to</tt> method, which is of course heavily used in many Rails applications to allow your controller to format results differently based on the MIME type of the incoming request. After eliminating a call to <tt>method_missing</tt> and some profiling and tweaking, we&#8217;re seeing an 8% improvement in the number of requests per second served with a simple <tt>respond_to</tt> that switches between three formats. The best part? No change at all required to the code of your application to take advantage of this speedup.</p></div>
-<h3 id="_improved_caching_performance">4.8. Improved Caching Performance</h3>
-<div class="paragraph"><p>Rails now keeps a per-request local cache of requests, cutting down on unnecessary reads and leading to better site performance. While this work was originally limited to <tt>MemCacheStore</tt>, it is available to any remote store than implements the required methods.</p></div>
-<div class="ulist"><ul>
-<li>
-<p>
-Lead Contributor: <a href="http://www.motionstandingstill.com/">Nahum Wild</a>
-</p>
-</li>
-</ul></div>
-<h3 id="_localized_views">4.9. Localized Views</h3>
-<div class="paragraph"><p>Rails can now provide localized views, depending on the locale that you have set. For example, suppose you have a <tt>Posts</tt> controller with a <tt>show</tt> action. By default, this will render <tt>app/views/posts/show.html.erb</tt>. But if you set <tt>I18n.locale = :da</tt>, it will render <tt>app/views/posts/show.da.html.erb</tt>. If the localized template isn&#8217;t present, the undecorated version will be used. Rails also includes <tt>I18n#available_locales</tt> and <tt>I18n::SimpleBackend#available_locales</tt>, which return an array of the translations that are available in the current Rails project.</p></div>
-<h3 id="_other_action_controller_changes">4.10. Other Action Controller Changes</h3>
-<div class="ulist"><ul>
-<li>
-<p>
-ETag handling has been cleaned up a bit: Rails will now skip sending an ETag header when there&#8217;s no body to the response or when sending files with <tt>send_file</tt>.
-</p>
-</li>
-<li>
-<p>
-The fact that Rails checks for IP spoofing can be a nuisance for sites that do heavy traffic with cell phones, because their proxies don&#8217;t generally set things up right. If that&#8217;s you, you can now set <tt>ActionController::Base.ip_spoofing_check = false</tt> to disable the check entirely.
-</p>
-</li>
-<li>
-<p>
-<tt>ActionController::Dispatcher</tt> now implements its own middleware stack, which you can see by running <tt>rake middleware</tt>.
-</p>
-</li>
-<li>
-<p>
-Cookie sessions now have persistent session identifiers, with API compatibility with the server-side stores.
-</p>
-</li>
-<li>
-<p>
-You can now use symbols for the <tt>:type</tt> option of <tt>send_file</tt> and <tt>send_data</tt>, like this: <tt>send_file("fabulous.png", :type =&gt; :png)</tt>.
-</p>
-</li>
-<li>
-<p>
-The <tt>:only</tt> and <tt>:except</tt> options for <tt>map.resources</tt> are no longer inherited by nested resources.
-</p>
-</li>
-</ul></div>
-</div>
-<h2 id="_action_view">5. Action View</h2>
-<div class="sectionbody">
-<div class="paragraph"><p>Action View in Rails 2.3 picks up nested model forms, improvements to <tt>render</tt>, more flexible prompts for the date select helpers, and a speedup in asset caching, among other things.</p></div>
-<h3 id="_nested_object_forms">5.1. Nested Object Forms</h3>
-<div class="paragraph"><p>Provided the parent model accepts nested attributes for the child objects (as discussed in the Active Record section), you can create nested forms using <tt>form_for</tt> and <tt>field_for</tt>. These forms can be nested arbitrarily deep, allowing you to edit complex object hierarchies on a single view without excessive code. For example, given this model:</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="font-weight: bold"><span style="color: #0000FF">class</span></span> Customer <span style="color: #990000">&lt;</span> ActiveRecord<span style="color: #990000">::</span>Base
- has_many <span style="color: #990000">:</span>orders
-
- accepts_nested_attributes_for <span style="color: #990000">:</span>orders<span style="color: #990000">,</span> <span style="color: #990000">:</span>allow_destroy <span style="color: #990000">=&gt;</span> <span style="font-weight: bold"><span style="color: #0000FF">true</span></span>
-<span style="font-weight: bold"><span style="color: #0000FF">end</span></span></tt></pre></div></div>
-<div class="paragraph"><p>You can write this view in Rails 2.3:</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="color: #FF0000">&lt;% form_for @customer do |customer_form| %&gt;</span>
- <span style="color: #FF0000">&lt;div&gt;</span>
- <span style="color: #FF0000">&lt;%= customer_form.label :name, 'Customer Name:' %&gt;</span>
- <span style="color: #FF0000">&lt;%= customer_form.text_field :name %&gt;</span>
- <span style="color: #FF0000">&lt;/div&gt;</span>
-
- <span style="color: #990000">&lt;!--</span> Here we call fields_for on the customer_form builder instance<span style="color: #990000">.</span>
- The block is called <span style="font-weight: bold"><span style="color: #0000FF">for</span></span> each member of the orders collection<span style="color: #990000">.</span> <span style="color: #990000">--&gt;</span>
- <span style="color: #FF0000">&lt;% customer_form.fields_for :orders do |order_form| %&gt;</span>
- <span style="color: #FF0000">&lt;p&gt;</span>
- <span style="color: #FF0000">&lt;div&gt;</span>
- <span style="color: #FF0000">&lt;%= order_form.label :number, 'Order Number:' %&gt;</span>
- <span style="color: #FF0000">&lt;%= order_form.text_field :number %&gt;</span>
- <span style="color: #FF0000">&lt;/div&gt;</span>
-
- <span style="color: #990000">&lt;!--</span> The allow_destroy option <span style="font-weight: bold"><span style="color: #0000FF">in</span></span> the model enables deletion of
- child records<span style="color: #990000">.</span> <span style="color: #990000">--&gt;</span>
- <span style="color: #FF0000">&lt;% unless order_form.object.new_record? %&gt;</span>
- <span style="color: #FF0000">&lt;div&gt;</span>
- <span style="color: #FF0000">&lt;%= order_form.label :_delete, 'Remove:' %&gt;</span>
- <span style="color: #FF0000">&lt;%= order_form.check_box :_delete %&gt;</span>
- <span style="color: #FF0000">&lt;/div&gt;</span>
- <span style="color: #FF0000">&lt;% end %&gt;</span>
- <span style="color: #FF0000">&lt;/p&gt;</span>
- <span style="color: #FF0000">&lt;% end %&gt;</span>
- <span style="color: #FF0000">&lt;% end %&gt;</span>
-
- <span style="color: #FF0000">&lt;%= customer_form.submit %&gt;</span>
-<span style="color: #FF0000">&lt;% end %&gt;</span></tt></pre></div></div>
-<div class="ulist"><ul>
-<li>
-<p>
-Lead Contributor: link_to:<a href="http://www.superalloy.nl/blog/">Eloy Duran</a>
-</p>
-</li>
-<li>
-<p>
-More Information:
-</p>
-<div class="ulist"><ul>
-<li>
-<p>
-link_to:<a href="http://weblog.rubyonrails.org/2009/1/26/nested-model-forms">Nested Model Forms</a>
-</p>
-</li>
-<li>
-<p>
-link_to:<a href="http://github.com/alloy/complex-form-examples/tree/nested_attributes">complex-form-examples</a>
-</p>
-</li>
-<li>
-<p>
-link_to:<a href="http://ryandaigle.com/articles/2009/2/1/what-s-new-in-edge-rails-nested-attributes">What&#8217;s New in Edge Rails: Nested Object Forms</a>
-</p>
-</li>
-</ul></div>
-</li>
-</ul></div>
-<h3 id="_smart_rendering_of_partials">5.2. Smart Rendering of Partials</h3>
-<div class="paragraph"><p>The render method has been getting smarter over the years, and it&#8217;s even smarter now. If you have an object or a collection and an appropriate partial, and the naming matches up, you can now just render the object and things will work. For example, in Rails 2.3, these render calls will work in your view (assuming sensible naming):</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt>render <span style="color: #009900">@article</span> <span style="font-style: italic"><span style="color: #9A1900"># Equivalent of render :partial =&gt; 'articles/_article', :object =&gt; @article</span></span>
-render <span style="color: #009900">@articles</span> <span style="font-style: italic"><span style="color: #9A1900"># Equivalent of render :partial =&gt; 'articles/_article', :collection =&gt; @articles</span></span></tt></pre></div></div>
-<div class="ulist"><ul>
-<li>
-<p>
-More Information: <a href="http://ryandaigle.com/articles/2008/11/20/what-s-new-in-edge-rails-render-stops-being-high-maintenance">What&#8217;s New in Edge Rails: render Stops Being High-Maintenance</a>
-</p>
-</li>
-</ul></div>
-<h3 id="_prompts_for_date_select_helpers">5.3. Prompts for Date Select Helpers</h3>
-<div class="paragraph"><p>In Rails 2.3, you can supply custom prompts for the various date select helpers (<tt>date_select</tt>, <tt>time_select</tt>, and <tt>datetime_select</tt>), the same way you can with collection select helpers. You can supply a prompt string or a hash of individual prompt strings for the various components. You can also just set <tt>:prompt</tt> to <tt>true</tt> to use the custom generic prompt:</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt>select_datetime<span style="color: #990000">(</span>DateTime<span style="color: #990000">.</span>now<span style="color: #990000">,</span> <span style="color: #990000">:</span>prompt <span style="color: #990000">=&gt;</span> <span style="font-weight: bold"><span style="color: #0000FF">true</span></span><span style="color: #990000">)</span>
-
-select_datetime<span style="color: #990000">(</span>DateTime<span style="color: #990000">.</span>now<span style="color: #990000">,</span> <span style="color: #990000">:</span>prompt <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"Choose date and time"</span><span style="color: #990000">)</span>
-
-select_datetime<span style="color: #990000">(</span>DateTime<span style="color: #990000">.</span>now<span style="color: #990000">,</span> <span style="color: #990000">:</span>prompt <span style="color: #990000">=&gt;</span>
- <span style="color: #FF0000">{</span><span style="color: #990000">:</span>day <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">'Choose day'</span><span style="color: #990000">,</span> <span style="color: #990000">:</span>month <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">'Choose month'</span><span style="color: #990000">,</span>
- <span style="color: #990000">:</span>year <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">'Choose year'</span><span style="color: #990000">,</span> <span style="color: #990000">:</span>hour <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">'Choose hour'</span><span style="color: #990000">,</span>
- <span style="color: #990000">:</span>minute <span style="color: #990000">=&gt;</span> <span style="color: #FF0000">'Choose minute'</span><span style="color: #FF0000">}</span><span style="color: #990000">)</span></tt></pre></div></div>
-<div class="paragraph"><p>Lead Contributor: <a href="http://samoliver.com/">Sam Oliver</a></p></div>
-<h3 id="_assettag_timestamp_caching">5.4. AssetTag Timestamp Caching</h3>
-<div class="paragraph"><p>You&#8217;re likely familiar with Rails' practice of adding timestamps to static asset paths as a "cache buster." This helps ensure that stale copies of things like images and stylesheets don&#8217;t get served out of the user&#8217;s browser cache when you change them on the server. You can now modify this behavior with the <tt>cache_asset_timestamps</tt> configuration option for Action View. If you enable the cache, then Rails will calculate the timestamp once when it first serves an asset, and save that value. This means fewer (expensive) file system calls to serve static assets - but it also means that you can&#8217;t modify any of the assets while the server is running and expect the changes to get picked up by clients.</p></div>
-<h3 id="_asset_hosts_as_objects">5.5. Asset Hosts as Objects</h3>
-<div class="paragraph"><p>Asset hosts get more flexible in edge Rails with the ability to declare an asset host as a specific object that responds to a call. This allows you to to implement any complex logic you need in your asset hosting.</p></div>
-<div class="ulist"><ul>
-<li>
-<p>
-More Information: <a href="http://github.com/dhh/asset-hosting-with-minimum-ssl/tree/master">asset-hosting-with-minimum-ssl</a>
-</p>
-</li>
-</ul></div>
-<h3 id="_grouped_options_for_select_helper_method">5.6. grouped_options_for_select Helper Method</h3>
-<div class="paragraph"><p>Action View already haD a bunch of helpers to aid in generating select controls, but now there&#8217;s one more: <tt>grouped_options_for_select</tt>. This one accepts an array or hash of strings, and converts them into a string of <tt>option</tt> tags wrapped with <tt>optgroup</tt> tags. For example:</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt>grouped_options_for_select<span style="color: #990000">([[</span><span style="color: #FF0000">"Hats"</span><span style="color: #990000">,</span> <span style="color: #990000">[</span><span style="color: #FF0000">"Baseball Cap"</span><span style="color: #990000">,</span><span style="color: #FF0000">"Cowboy Hat"</span><span style="color: #990000">]]],</span>
- <span style="color: #FF0000">"Cowboy Hat"</span><span style="color: #990000">,</span> <span style="color: #FF0000">"Choose a product..."</span><span style="color: #990000">)</span></tt></pre></div></div>
-<div class="paragraph"><p>returns</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="color: #FF0000">&lt;option value=""&gt;</span>Choose a product<span style="color: #990000">...</span><span style="color: #FF0000">&lt;/option&gt;</span>
-<span style="color: #FF0000">&lt;optgroup label="Hats"&gt;</span>
- <span style="color: #FF0000">&lt;option value="Baseball Cap"&gt;</span>Baseball Cap<span style="color: #FF0000">&lt;/option&gt;</span>
- <span style="color: #FF0000">&lt;option selected="selected" value="Cowboy Hat"&gt;</span>Cowboy Hat<span style="color: #FF0000">&lt;/option&gt;</span>
-<span style="color: #FF0000">&lt;/optgroup&gt;</span></tt></pre></div></div>
-<h3 id="_other_action_view_changes">5.7. Other Action View Changes</h3>
-<div class="ulist"><ul>
-<li>
-<p>
-Token generation for CSRF protection has been simplified; now Rails uses a simple random string generated by <tt>ActiveSupport::SecureRandom</tt> rather than mucking around with session IDs.
-</p>
-</li>
-<li>
-<p>
-<tt>auto_link</tt> now properly applies options (such as :target and :class) to generated e-mail links.
-</p>
-</li>
-<li>
-<p>
-The <tt>autolink</tt> helper has been refactored to make it a bit less messy and more intuitive.
-</p>
-</li>
-</ul></div>
-</div>
-<h2 id="_active_support">6. Active Support</h2>
-<div class="sectionbody">
-<div class="paragraph"><p>Active Support has a few interesting changes, including the introduction of <tt>Object#try</tt>.</p></div>
-<h3 id="_object_try">6.1. Object#try</h3>
-<div class="paragraph"><p>A lot of folks have adopted the notion of using try() to attempt operations on objects - It&#8217;s especially helpful in views where you can avoid nil-checking by writing code like <tt>&lt;%= @person.try(:name) %&gt;</tt>. Well, now it&#8217;s baked right into Rails. As implemented in Rails, it raises <tt>NoMethodError</tt> on private methods and always returns <tt>nil</tt> if the object is nil.</p></div>
-<div class="ulist"><ul>
-<li>
-<p>
-More Information: <a href="http://ozmm.org/posts/try.html">try()</a>.
-</p>
-</li>
-</ul></div>
-<h3 id="_object_tap_backport">6.2. Object#tap Backport</h3>
-<div class="paragraph"><p><tt>Object#tap</tt> is an addition to "Ruby 1.9":http://www.ruby-doc.org/core-1.9/classes/Object.html#M000309 and 1.8.7 that is similar to the <tt>returning</tt> method that Rails has had for a while: it yields to a block, and then returns the object that was yielded. Rails now includes code to make this available under older versions of Ruby as well.</p></div>
-<h3 id="_fractional_seconds_for_timewithzone">6.3. Fractional seconds for TimeWithZone</h3>
-<div class="paragraph"><p>The <tt>Time</tt> and <tt>TimeWithZone</tt> classes include an <tt>xmlschema</tt> method to return the time in an XML-friendly string. As of Rails 2.3, <tt>TimeWithZone</tt> supports the same argument for specifying the number of digits in the fractional second part of the returned string that <tt>Time</tt> does:</p></div>
-<div class="listingblock">
-<div class="content"><!-- Generator: GNU source-highlight 2.9
-by Lorenzo Bettini
-http://www.lorenzobettini.it
-http://www.gnu.org/software/src-highlite -->
-<pre><tt><span style="color: #990000">&gt;&gt;</span> Time<span style="color: #990000">.</span>zone<span style="color: #990000">.</span>now<span style="color: #990000">.</span>xmlschema<span style="color: #990000">(</span><span style="color: #993399">6</span><span style="color: #990000">)</span>
-<span style="color: #990000">=&gt;</span> <span style="color: #FF0000">"2009-01-16T13:00:06.13653Z"</span></tt></pre></div></div>
-<div class="paragraph"><p>Lead Contributor: <a href="http://www.workingwithrails.com/person/13536-nicholas-dainty">Nicholas Dainty</a></p></div>
-<h3 id="_json_key_quoting">6.4. JSON Key Quoting</h3>
-<div class="paragraph"><p>If you look up the spec on the "json.org" site, you&#8217;ll discover that all keys in a JSON structure must be strings, and they must be quoted with double quotes. Starting with Rails 2.3, we doe the right thing here, even with numeric keys.</p></div>
-<h3 id="_other_active_s