railties 3.1.1 → 3.1.2.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (189) hide show
  1. data/CHANGELOG.md +2382 -0
  2. data/guides/output/2_2_release_notes.html +565 -0
  3. data/guides/output/2_3_release_notes.html +713 -0
  4. data/guides/output/3_0_release_notes.html +652 -0
  5. data/guides/output/3_1_release_notes.html +670 -0
  6. data/guides/output/action_controller_overview.html +925 -0
  7. data/guides/output/action_mailer_basics.html +658 -0
  8. data/guides/output/action_view_overview.html +1471 -0
  9. data/guides/output/active_model_basics.html +349 -0
  10. data/guides/output/active_record_basics.html +364 -0
  11. data/guides/output/active_record_querying.html +1272 -0
  12. data/guides/output/active_record_validations_callbacks.html +1292 -0
  13. data/guides/output/active_resource_basics.html +252 -0
  14. data/guides/output/active_support_core_extensions.html +3374 -0
  15. data/guides/output/ajax_on_rails.html +412 -0
  16. data/guides/output/api_documentation_guidelines.html +317 -0
  17. data/guides/output/asset_pipeline.html +691 -0
  18. data/guides/output/association_basics.html +1742 -0
  19. data/guides/output/caching_with_rails.html +533 -0
  20. data/guides/output/command_line.html +662 -0
  21. data/guides/output/configuring.html +811 -0
  22. data/guides/output/contribute.html +216 -0
  23. data/guides/output/contributing_to_ruby_on_rails.html +465 -0
  24. data/guides/output/credits.html +210 -0
  25. data/guides/output/debugging_rails_applications.html +791 -0
  26. data/guides/output/engines.html +673 -0
  27. data/guides/output/form_helpers.html +850 -0
  28. data/guides/output/generators.html +725 -0
  29. data/guides/output/getting_started.html +1980 -0
  30. data/guides/output/i18n.html +1054 -0
  31. data/guides/output/images/belongs_to.png +0 -0
  32. data/guides/output/images/book_icon.gif +0 -0
  33. data/guides/output/images/bullet.gif +0 -0
  34. data/guides/output/images/challenge.png +0 -0
  35. data/guides/output/images/chapters_icon.gif +0 -0
  36. data/guides/output/images/check_bullet.gif +0 -0
  37. data/guides/output/images/credits_pic_blank.gif +0 -0
  38. data/guides/output/images/csrf.png +0 -0
  39. data/guides/output/images/customized_error_messages.png +0 -0
  40. data/guides/output/images/edge_badge.png +0 -0
  41. data/guides/output/images/error_messages.png +0 -0
  42. data/guides/output/images/feature_tile.gif +0 -0
  43. data/guides/output/images/footer_tile.gif +0 -0
  44. data/guides/output/images/fxn.png +0 -0
  45. data/guides/output/images/grey_bullet.gif +0 -0
  46. data/guides/output/images/habtm.png +0 -0
  47. data/guides/output/images/has_many.png +0 -0
  48. data/guides/output/images/has_many_through.png +0 -0
  49. data/guides/output/images/has_one.png +0 -0
  50. data/guides/output/images/has_one_through.png +0 -0
  51. data/guides/output/images/header_backdrop.png +0 -0
  52. data/guides/output/images/header_tile.gif +0 -0
  53. data/guides/output/images/i18n/demo_html_safe.png +0 -0
  54. data/guides/output/images/i18n/demo_localized_pirate.png +0 -0
  55. data/guides/output/images/i18n/demo_translated_en.png +0 -0
  56. data/guides/output/images/i18n/demo_translated_pirate.png +0 -0
  57. data/guides/output/images/i18n/demo_translation_missing.png +0 -0
  58. data/guides/output/images/i18n/demo_untranslated.png +0 -0
  59. data/guides/output/images/icons/README +5 -0
  60. data/guides/output/images/icons/callouts/1.png +0 -0
  61. data/guides/output/images/icons/callouts/10.png +0 -0
  62. data/guides/output/images/icons/callouts/11.png +0 -0
  63. data/guides/output/images/icons/callouts/12.png +0 -0
  64. data/guides/output/images/icons/callouts/13.png +0 -0
  65. data/guides/output/images/icons/callouts/14.png +0 -0
  66. data/guides/output/images/icons/callouts/15.png +0 -0
  67. data/guides/output/images/icons/callouts/2.png +0 -0
  68. data/guides/output/images/icons/callouts/3.png +0 -0
  69. data/guides/output/images/icons/callouts/4.png +0 -0
  70. data/guides/output/images/icons/callouts/5.png +0 -0
  71. data/guides/output/images/icons/callouts/6.png +0 -0
  72. data/guides/output/images/icons/callouts/7.png +0 -0
  73. data/guides/output/images/icons/callouts/8.png +0 -0
  74. data/guides/output/images/icons/callouts/9.png +0 -0
  75. data/guides/output/images/icons/caution.png +0 -0
  76. data/guides/output/images/icons/example.png +0 -0
  77. data/guides/output/images/icons/home.png +0 -0
  78. data/guides/output/images/icons/important.png +0 -0
  79. data/guides/output/images/icons/next.png +0 -0
  80. data/guides/output/images/icons/note.png +0 -0
  81. data/guides/output/images/icons/prev.png +0 -0
  82. data/guides/output/images/icons/tip.png +0 -0
  83. data/guides/output/images/icons/up.png +0 -0
  84. data/guides/output/images/icons/warning.png +0 -0
  85. data/guides/output/images/jaimeiniesta.jpg +0 -0
  86. data/guides/output/images/nav_arrow.gif +0 -0
  87. data/guides/output/images/polymorphic.png +0 -0
  88. data/guides/output/images/posts_index.png +0 -0
  89. data/guides/output/images/radar.png +0 -0
  90. data/guides/output/images/rails_guides_logo.gif +0 -0
  91. data/guides/output/images/rails_logo_remix.gif +0 -0
  92. data/guides/output/images/rails_welcome.png +0 -0
  93. data/guides/output/images/session_fixation.png +0 -0
  94. data/guides/output/images/tab_grey.gif +0 -0
  95. data/guides/output/images/tab_info.gif +0 -0
  96. data/guides/output/images/tab_note.gif +0 -0
  97. data/guides/output/images/tab_red.gif +0 -0
  98. data/guides/output/images/tab_yellow.gif +0 -0
  99. data/guides/output/images/tab_yellow.png +0 -0
  100. data/guides/output/images/validation_error_messages.png +0 -0
  101. data/guides/output/images/vijaydev.jpg +0 -0
  102. data/guides/output/index.html +300 -0
  103. data/guides/output/initialization.html +1087 -0
  104. data/guides/output/javascripts/guides.js +7 -0
  105. data/guides/output/javascripts/syntaxhighlighter/shBrushAS3.js +59 -0
  106. data/guides/output/javascripts/syntaxhighlighter/shBrushAppleScript.js +75 -0
  107. data/guides/output/javascripts/syntaxhighlighter/shBrushBash.js +59 -0
  108. data/guides/output/javascripts/syntaxhighlighter/shBrushCSharp.js +65 -0
  109. data/guides/output/javascripts/syntaxhighlighter/shBrushColdFusion.js +100 -0
  110. data/guides/output/javascripts/syntaxhighlighter/shBrushCpp.js +97 -0
  111. data/guides/output/javascripts/syntaxhighlighter/shBrushCss.js +91 -0
  112. data/guides/output/javascripts/syntaxhighlighter/shBrushDelphi.js +55 -0
  113. data/guides/output/javascripts/syntaxhighlighter/shBrushDiff.js +41 -0
  114. data/guides/output/javascripts/syntaxhighlighter/shBrushErlang.js +52 -0
  115. data/guides/output/javascripts/syntaxhighlighter/shBrushGroovy.js +67 -0
  116. data/guides/output/javascripts/syntaxhighlighter/shBrushJScript.js +52 -0
  117. data/guides/output/javascripts/syntaxhighlighter/shBrushJava.js +57 -0
  118. data/guides/output/javascripts/syntaxhighlighter/shBrushJavaFX.js +58 -0
  119. data/guides/output/javascripts/syntaxhighlighter/shBrushPerl.js +72 -0
  120. data/guides/output/javascripts/syntaxhighlighter/shBrushPhp.js +88 -0
  121. data/guides/output/javascripts/syntaxhighlighter/shBrushPlain.js +33 -0
  122. data/guides/output/javascripts/syntaxhighlighter/shBrushPowerShell.js +74 -0
  123. data/guides/output/javascripts/syntaxhighlighter/shBrushPython.js +64 -0
  124. data/guides/output/javascripts/syntaxhighlighter/shBrushRuby.js +55 -0
  125. data/guides/output/javascripts/syntaxhighlighter/shBrushSass.js +94 -0
  126. data/guides/output/javascripts/syntaxhighlighter/shBrushScala.js +51 -0
  127. data/guides/output/javascripts/syntaxhighlighter/shBrushSql.js +66 -0
  128. data/guides/output/javascripts/syntaxhighlighter/shBrushVb.js +56 -0
  129. data/guides/output/javascripts/syntaxhighlighter/shBrushXml.js +69 -0
  130. data/guides/output/javascripts/syntaxhighlighter/shCore.js +17 -0
  131. data/guides/output/layout.html +312 -0
  132. data/guides/output/layouts_and_rendering.html +1257 -0
  133. data/guides/output/migrations.html +751 -0
  134. data/guides/output/nested_model_forms.html +350 -0
  135. data/guides/output/performance_testing.html +858 -0
  136. data/guides/output/plugins.html +590 -0
  137. data/guides/output/rails_application_templates.html +368 -0
  138. data/guides/output/rails_on_rack.html +408 -0
  139. data/guides/output/routing.html +1246 -0
  140. data/guides/output/ruby_on_rails_guides_guidelines.html +218 -0
  141. data/guides/output/security.html +968 -0
  142. data/guides/output/stylesheets/fixes.css +16 -0
  143. data/guides/output/stylesheets/main.css +445 -0
  144. data/guides/output/stylesheets/print.css +52 -0
  145. data/guides/output/stylesheets/reset.css +43 -0
  146. data/guides/output/stylesheets/style.css +13 -0
  147. data/guides/output/stylesheets/syntaxhighlighter/shCore.css +226 -0
  148. data/guides/output/stylesheets/syntaxhighlighter/shCoreDefault.css +328 -0
  149. data/guides/output/stylesheets/syntaxhighlighter/shCoreDjango.css +331 -0
  150. data/guides/output/stylesheets/syntaxhighlighter/shCoreEclipse.css +339 -0
  151. data/guides/output/stylesheets/syntaxhighlighter/shCoreEmacs.css +324 -0
  152. data/guides/output/stylesheets/syntaxhighlighter/shCoreFadeToGrey.css +328 -0
  153. data/guides/output/stylesheets/syntaxhighlighter/shCoreMDUltra.css +324 -0
  154. data/guides/output/stylesheets/syntaxhighlighter/shCoreMidnight.css +324 -0
  155. data/guides/output/stylesheets/syntaxhighlighter/shCoreRDark.css +324 -0
  156. data/guides/output/stylesheets/syntaxhighlighter/shThemeDefault.css +117 -0
  157. data/guides/output/stylesheets/syntaxhighlighter/shThemeDjango.css +120 -0
  158. data/guides/output/stylesheets/syntaxhighlighter/shThemeEclipse.css +128 -0
  159. data/guides/output/stylesheets/syntaxhighlighter/shThemeEmacs.css +113 -0
  160. data/guides/output/stylesheets/syntaxhighlighter/shThemeFadeToGrey.css +117 -0
  161. data/guides/output/stylesheets/syntaxhighlighter/shThemeMDUltra.css +113 -0
  162. data/guides/output/stylesheets/syntaxhighlighter/shThemeMidnight.css +113 -0
  163. data/guides/output/stylesheets/syntaxhighlighter/shThemeRDark.css +113 -0
  164. data/guides/output/stylesheets/syntaxhighlighter/shThemeRailsGuides.css +116 -0
  165. data/guides/output/testing.html +1182 -0
  166. data/guides/source/active_record_validations_callbacks.textile +3 -3
  167. data/guides/source/active_support_core_extensions.textile +2 -2
  168. data/guides/source/asset_pipeline.textile +7 -5
  169. data/guides/source/association_basics.textile +2 -4
  170. data/guides/source/command_line.textile +1 -1
  171. data/guides/source/configuring.textile +4 -2
  172. data/guides/source/contributing_to_ruby_on_rails.textile +6 -6
  173. data/guides/source/initialization.textile +2 -2
  174. data/guides/source/performance_testing.textile +1 -1
  175. data/guides/source/routing.textile +1 -1
  176. data/guides/source/security.textile +2 -2
  177. data/lib/rails/commands/server.rb +1 -1
  178. data/lib/rails/engine.rb +1 -1
  179. data/lib/rails/generators/app_base.rb +2 -1
  180. data/lib/rails/generators/base.rb +3 -3
  181. data/lib/rails/generators/rails/app/templates/gitignore +15 -5
  182. data/lib/rails/rack.rb +0 -1
  183. data/lib/rails/tasks/documentation.rake +7 -7
  184. data/lib/rails/tasks/misc.rake +0 -2
  185. data/lib/rails/test_unit/testing.rake +2 -0
  186. data/lib/rails/version.rb +2 -2
  187. metadata +495 -326
  188. data/CHANGELOG +0 -2371
  189. data/lib/rails/rack/content_length.rb +0 -38
@@ -0,0 +1,713 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
2
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3
+
4
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
+ <head>
6
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
7
+
8
+ <title>Ruby on Rails Guides: Ruby on Rails 2.3 Release Notes</title>
9
+
10
+ <link rel="stylesheet" type="text/css" href="stylesheets/style.css" />
11
+ <link rel="stylesheet" type="text/css" href="stylesheets/print.css" media="print" />
12
+
13
+ <link rel="stylesheet" type="text/css" href="stylesheets/syntaxhighlighter/shCore.css" />
14
+ <link rel="stylesheet" type="text/css" href="stylesheets/syntaxhighlighter/shThemeRailsGuides.css" />
15
+
16
+ <link rel="stylesheet" type="text/css" href="stylesheets/fixes.css" />
17
+ </head>
18
+ <body class="guide">
19
+ <div id="topNav">
20
+ <div class="wrapper">
21
+ <strong>More at <a href="http://rubyonrails.org/">rubyonrails.org:</a> </strong>
22
+ <a href="http://rubyonrails.org/">Overview</a> |
23
+ <a href="http://rubyonrails.org/download">Download</a> |
24
+ <a href="http://rubyonrails.org/deploy">Deploy</a> |
25
+ <a href="https://github.com/rails/rails">Code</a> |
26
+ <a href="http://rubyonrails.org/screencasts">Screencasts</a> |
27
+ <a href="http://rubyonrails.org/documentation">Documentation</a> |
28
+ <a href="http://rubyonrails.org/ecosystem">Ecosystem</a> |
29
+ <a href="http://rubyonrails.org/community">Community</a> |
30
+ <a href="http://weblog.rubyonrails.org/">Blog</a>
31
+ </div>
32
+ </div>
33
+ <div id="header">
34
+ <div class="wrapper clearfix">
35
+ <h1><a href="index.html" title="Return to home page">Guides.rubyonrails.org</a></h1>
36
+ <p class="hide"><a href="#mainCol">Skip navigation</a>.</p>
37
+ <ul class="nav">
38
+ <li><a href="index.html">Home</a></li>
39
+ <li class="index"><a href="index.html" onclick="guideMenu(); return false;" id="guidesMenu">Guides Index</a>
40
+ <div id="guides" class="clearfix" style="display: none;">
41
+ <hr />
42
+ <dl class="L">
43
+ <dt>Start Here</dt>
44
+ <dd><a href="getting_started.html">Getting Started with Rails</a></dd>
45
+ <dt>Models</dt>
46
+ <dd><a href="migrations.html">Rails Database Migrations</a></dd>
47
+ <dd><a href="active_record_validations_callbacks.html">Active Record Validations and Callbacks</a></dd>
48
+ <dd><a href="association_basics.html">Active Record Associations</a></dd>
49
+ <dd><a href="active_record_querying.html">Active Record Query Interface</a></dd>
50
+ <dt>Views</dt>
51
+ <dd><a href="layouts_and_rendering.html">Layouts and Rendering in Rails</a></dd>
52
+ <dd><a href="form_helpers.html">Action View Form Helpers</a></dd>
53
+ <dt>Controllers</dt>
54
+ <dd><a href="action_controller_overview.html">Action Controller Overview</a></dd>
55
+ <dd><a href="routing.html">Rails Routing from the Outside In</a></dd>
56
+ </dl>
57
+ <dl class="R">
58
+ <dt>Digging Deeper</dt>
59
+ <dd><a href="active_support_core_extensions.html">Active Support Core Extensions</a></dd>
60
+ <dd><a href="i18n.html">Rails Internationalization API</a></dd>
61
+ <dd><a href="action_mailer_basics.html">Action Mailer Basics</a></dd>
62
+ <dd><a href="testing.html">Testing Rails Applications</a></dd>
63
+ <dd><a href="security.html">Securing Rails Applications</a></dd>
64
+ <dd><a href="debugging_rails_applications.html">Debugging Rails Applications</a></dd>
65
+ <dd><a href="performance_testing.html">Performance Testing Rails Applications</a></dd>
66
+ <dd><a href="configuring.html">Configuring Rails Applications</a></dd>
67
+ <dd><a href="command_line.html">Rails Command Line Tools and Rake Tasks</a></dd>
68
+ <dd><a href="caching_with_rails.html">Caching with Rails</a></dd>
69
+ <dd><a href="asset_pipeline.html">Asset Pipeline</a></dd>
70
+
71
+ <dt>Extending Rails</dt>
72
+ <dd><a href="plugins.html">The Basics of Creating Rails Plugins</a></dd>
73
+ <dd><a href="rails_on_rack.html">Rails on Rack</a></dd>
74
+ <dd><a href="generators.html">Creating and Customizing Rails Generators</a></dd>
75
+
76
+ <dt>Contributing to Ruby on Rails</dt>
77
+ <dd><a href="contributing_to_ruby_on_rails.html">Contributing to Ruby on Rails</a></dd>
78
+ <dd><a href="api_documentation_guidelines.html">API Documentation Guidelines</a></dd>
79
+ <dd><a href="ruby_on_rails_guides_guidelines.html">Ruby on Rails Guides Guidelines</a></dd>
80
+
81
+ <dt>Release Notes</dt>
82
+ <dd><a href="3_1_release_notes.html">Ruby on Rails 3.1 Release Notes</a></dd>
83
+ <dd><a href="3_0_release_notes.html">Ruby on Rails 3.0 Release Notes</a></dd>
84
+ <dd><a href="2_3_release_notes.html">Ruby on Rails 2.3 Release Notes</a></dd>
85
+ <dd><a href="2_2_release_notes.html">Ruby on Rails 2.2 Release Notes</a></dd>
86
+ </dl>
87
+ </div>
88
+ </li>
89
+ <li><a href="contributing_to_ruby_on_rails.html">Contribute</a></li>
90
+ <li><a href="credits.html">Credits</a></li>
91
+ </ul>
92
+ </div>
93
+ </div>
94
+ <hr class="hide" />
95
+
96
+ <div id="feature">
97
+ <div class="wrapper">
98
+ <h2>Ruby on Rails 2.3 Release Notes</h2>
99
+ <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>
100
+
101
+ <div id="subCol">
102
+ <h3 class="chapter"><img src="images/chapters_icon.gif" alt="" />Chapters</h3>
103
+ <ol class="chapters">
104
+ <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="#ruby-1-9-1-support">Ruby 1.9.1 Support</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="#batch-processing">Batch Processing</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="#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"><span class="caps">HTTP</span> 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"><span class="caps">MIME</span> Type Handling Changes</a></li> <li><a href="#optimization-of-respond_to">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="#partial-scoping-for-translations">Partial Scoping for Translations</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="#disabled-option-tags-for-form-select-helpers">Disabled Option Tags for Form Select Helpers</a></li> <li><a href="#a-note-about-template-loading">A Note About Template Loading</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="#swappable-parsers-for-xmlmini">Swappable Parsers for XMLmini</a></li> <li><a href="#fractional-seconds-for-timewithzone">Fractional seconds for TimeWithZone</a></li> <li><a href="#json-key-quoting"><span class="caps">JSON</span> 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="#rake-gem-task-rewrite">rake gem Task Rewrite</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>
105
+ </div>
106
+ </div>
107
+
108
+ <div id="container">
109
+ <div class="wrapper">
110
+ <div id="mainCol">
111
+ <h3 id="application-architecture">1 Application Architecture</h3>
112
+ <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>
113
+ <h4 id="rack-integration">1.1 Rack Integration</h4>
114
+ <p>Rails has now broken with its <span class="caps">CGI</span> past, and uses Rack everywhere. This required and resulted in a tremendous number of internal changes (but if you use <span class="caps">CGI</span>, don&#8217;t worry; Rails now supports <span class="caps">CGI</span> 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>
115
+ <ul>
116
+ <li>Sessions</li>
117
+ <li>Cookies</li>
118
+ <li>File uploads</li>
119
+ <li><span class="caps">JSON</span>/<span class="caps">XML</span> APIs</li>
120
+ </ul>
121
+ <p>Here&#8217;s a summary of the rack-related changes:</p>
122
+ <ul>
123
+ <li><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.</li>
124
+ <li>The <span class="caps">FCGI</span> handler goes through Rack.</li>
125
+ <li><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>.</li>
126
+ <li>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.</li>
127
+ <li>The integration test runner has been modified to execute the entire middleware and application stack. This makes integration tests perfect for testing Rack middleware.</li>
128
+ <li><tt>ActionController::CGIHandler</tt> is a backwards compatible <span class="caps">CGI</span> wrapper around Rack. The <tt>CGIHandler</tt> is meant to take an old <span class="caps">CGI</span> object and convert its environment information into a Rack compatible form.</li>
129
+ <li><tt>CgiRequest</tt> and <tt>CgiResponse</tt> have been removed.</li>
130
+ <li>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).</li>
131
+ <li>You no longer need to use <tt>CGI::Cookie.new</tt> in your tests for setting a cookie value. Assigning a <tt>String</tt> value to request.cookies[&#8220;foo&#8221;] now sets the cookie as expected.</li>
132
+ <li><tt>CGI::Session::CookieStore</tt> has been replaced by <tt>ActionController::Session::CookieStore</tt>.</li>
133
+ <li><tt>CGI::Session::MemCacheStore</tt> has been replaced by <tt>ActionController::Session::MemCacheStore</tt>.</li>
134
+ <li><tt>CGI::Session::ActiveRecordStore</tt> has been replaced by <tt>ActiveRecord::SessionStore</tt>.</li>
135
+ <li>You can still change your session store with <tt>ActionController::Base.session_store = :active_record_store</tt>.</li>
136
+ <li>Default sessions options are still set with <tt>ActionController::Base.session = { :key => "..." }</tt>. However, the <tt>:session_domain</tt> option has been renamed to <tt>:domain</tt>.</li>
137
+ <li>The mutex that normally wraps your entire request has been moved into middleware, <tt>ActionController::Lock</tt>.</li>
138
+ <li><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['type']</tt> in test requests. Use <tt>response.content_type</tt> instead.</li>
139
+ <li><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.</li>
140
+ <li>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>.</li>
141
+ <li><tt>ActionController::Request</tt> inherits from <tt>Rack::Request</tt>.</li>
142
+ <li>Instead of <tt>config.action_controller.session = { :session_key => 'foo', ...</tt> use <tt>config.action_controller.session = { :key => 'foo', ...</tt>.</li>
143
+ <li>Using the <tt>ParamsParser</tt> middleware preprocesses any <span class="caps">XML</span>, <span class="caps">JSON</span>, or <span class="caps">YAML</span> requests so they can be read normally with any <tt>Rack::Request</tt> object after it.</li>
144
+ </ul>
145
+ <h4 id="renewed-support-for-rails-engines">1.2 Renewed Support for Rails Engines</h4>
146
+ <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, and Action Mailer as well as Action View will use views from engines and other plugins.</p>
147
+ <h3 id="documentation">2 Documentation</h3>
148
+ <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://edgeguides.rubyonrails.org/">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>
149
+ <ul>
150
+ <li>More Information: <a href="http://weblog.rubyonrails.org/2009/1/15/rails-documentation-projects">Rails Documentation Projects</a>.</li>
151
+ </ul>
152
+ <h3 id="ruby-1-9-1-support">3 Ruby 1.9.1 Support</h3>
153
+ <p>Rails 2.3 should pass all of its own tests whether you are running on Ruby 1.8 or the now-released Ruby 1.9.1. You should be aware, though, that moving to 1.9.1 entails checking all of the data adapters, plugins, and other code that you depend on for Ruby 1.9.1 compatibility, as well as Rails core.</p>
154
+ <h3 id="active-record">4 Active Record</h3>
155
+ <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 and default scopes, and batch processing.</p>
156
+ <h4 id="nested-attributes">4.1 Nested Attributes</h4>
157
+ <p>Active Record can now update the attributes on nested models directly, provided you tell it to do so:</p>
158
+ <div class="code_container">
159
+ <pre class="brush: ruby; gutter: false; toolbar: false">
160
+ class Book &lt; ActiveRecord::Base
161
+ has_one :author
162
+ has_many :pages
163
+
164
+ accepts_nested_attributes_for :author, :pages
165
+ end
166
+ </pre>
167
+ </div>
168
+ <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>
169
+ <p>You can also specify requirements for any new records that are added via nested attributes using the <tt>:reject_if</tt> option:</p>
170
+ <div class="code_container">
171
+ <pre class="brush: ruby; gutter: false; toolbar: false">
172
+ accepts_nested_attributes_for :author,
173
+ :reject_if =&gt; proc { |attributes| attributes['name'].blank? }
174
+ </pre>
175
+ </div>
176
+ <ul>
177
+ <li>Lead Contributor: <a href="http://superalloy.nl/">Eloy Duran</a></li>
178
+ <li>More Information: <a href="http://weblog.rubyonrails.org/2009/1/26/nested-model-forms">Nested Model Forms</a></li>
179
+ </ul>
180
+ <h4 id="nested-transactions">4.2 Nested Transactions</h4>
181
+ <p>Active Record now supports nested transactions, a much-requested feature. Now you can write code like this:</p>
182
+ <div class="code_container">
183
+ <pre class="brush: ruby; gutter: false; toolbar: false">
184
+ User.transaction do
185
+ User.create(:username =&gt; 'Admin')
186
+ User.transaction(:requires_new =&gt; true) do
187
+ User.create(:username =&gt; 'Regular')
188
+ raise ActiveRecord::Rollback
189
+ end
190
+ end
191
+
192
+ User.find(:all) # =&gt; Returns only Admin
193
+ </pre>
194
+ </div>
195
+ <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>
196
+ <ul>
197
+ <li>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></li>
198
+ </ul>
199
+ <h4 id="dynamic-scopes">4.3 Dynamic Scopes</h4>
200
+ <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>
201
+ <div class="code_container">
202
+ <pre class="brush: ruby; gutter: false; toolbar: false">
203
+ Order.scoped_by_customer_id(12)
204
+ Order.scoped_by_customer_id(12).find(:all,
205
+ :conditions =&gt; &quot;status = 'open'&quot;)
206
+ Order.scoped_by_customer_id(12).scoped_by_status(&quot;open&quot;)
207
+ </pre>
208
+ </div>
209
+ <p>There&#8217;s nothing to define to use dynamic scopes: they just work.</p>
210
+ <ul>
211
+ <li>Lead Contributor: <a href="http://evilmartians.com/">Yaroslav Markin</a></li>
212
+ <li>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>.</li>
213
+ </ul>
214
+ <h4 id="default-scopes">4.4 Default Scopes</h4>
215
+ <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 => 'name ASC'</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>
216
+ <ul>
217
+ <li>Lead Contributor: Paweł Kondzior</li>
218
+ <li>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></li>
219
+ </ul>
220
+ <h4 id="batch-processing">4.5 Batch Processing</h4>
221
+ <p>You can now process large numbers of records from an ActiveRecord model with less pressure on memory by using <tt>find_in_batches</tt>:</p>
222
+ <div class="code_container">
223
+ <pre class="brush: ruby; gutter: false; toolbar: false">
224
+ Customer.find_in_batches(:conditions =&gt; {:active =&gt; true}) do |customer_group|
225
+ customer_group.each { |customer| customer.update_account_balance! }
226
+ end
227
+ </pre>
228
+ </div>
229
+ <p>You can pass most of the <tt>find</tt> options into <tt>find_in_batches</tt>. However, you cannot specify the order that records will be returned in (they will always be returned in ascending order of primary key, which must be an integer), or use the <tt>:limit</tt> option. Instead, use the <tt>:batch_size</tt> option, which defaults to 1000, to set the number of records that will be returned in each batch.</p>
230
+ <p>The new <tt>find_each</tt> method provides a wrapper around <tt>find_in_batches</tt> that returns individual records, with the find itself being done in batches (of 1000 by default):</p>
231
+ <div class="code_container">
232
+ <pre class="brush: ruby; gutter: false; toolbar: false">
233
+ Customer.find_each do |customer|
234
+ customer.update_account_balance!
235
+ end
236
+ </pre>
237
+ </div>
238
+ <p>Note that you should only use this method for batch processing: for small numbers of records (less than 1000), you should just use the regular find methods with your own loop.</p>
239
+ <ul>
240
+ <li>More Information (at that point the convenience method was called just <tt>each</tt>):
241
+ <ul>
242
+ <li><a href="http://afreshcup.com/2009/02/23/rails-23-batch-finding/">Rails 2.3: Batch Finding</a></li>
243
+ <li><a href="http://ryandaigle.com/articles/2009/2/23/what-s-new-in-edge-rails-batched-find">What&#8217;s New in Edge Rails: Batched Find</a></li>
244
+ </ul></li>
245
+ </ul>
246
+ <h4 id="multiple-conditions-for-callbacks">4.6 Multiple Conditions for Callbacks</h4>
247
+ <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>
248
+ <div class="code_container">
249
+ <pre class="brush: ruby; gutter: false; toolbar: false">
250
+ before_save :update_credit_rating, :if =&gt; :active,
251
+ :unless =&gt; [:admin, :cash_only]
252
+ </pre>
253
+ </div>
254
+ <ul>
255
+ <li>Lead Contributor: L. Caviola</li>
256
+ </ul>
257
+ <h4 id="find-with-having">4.7 Find with having</h4>
258
+ <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 <span class="caps">SQL</span> backgrounds know, this allows filtering based on grouped results:</p>
259
+ <div class="code_container">
260
+ <pre class="brush: ruby; gutter: false; toolbar: false">
261
+ developers = Developer.find(:all, :group =&gt; &quot;salary&quot;,
262
+ :having =&gt; &quot;sum(salary) &gt; 10000&quot;, :select =&gt; &quot;salary&quot;)
263
+ </pre>
264
+ </div>
265
+ <ul>
266
+ <li>Lead Contributor: <a href="http://github.com/miloops">Emilio Tagua</a></li>
267
+ </ul>
268
+ <h4 id="reconnecting-mysql-connections">4.8 Reconnecting MySQL Connections</h4>
269
+ <p>MySQL supports a reconnect flag in its connections &#8211; 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>
270
+ <ul>
271
+ <li>Lead Contributor: <a href="http://twitter.com/dubek">Dov Murik</a></li>
272
+ <li>More information:
273
+ <ul>
274
+ <li><a href="http://dev.mysql.com/doc/refman/5.0/en/auto-reconnect.html">Controlling Automatic Reconnection Behavior</a></li>
275
+ <li><a href="http://groups.google.com/group/rubyonrails-core/browse_thread/thread/49d2a7e9c96cb9f4">MySQL auto-reconnect revisited</a></li>
276
+ </ul></li>
277
+ </ul>
278
+ <h4 id="other-active-record-changes">4.9 Other Active Record Changes</h4>
279
+ <ul>
280
+ <li>An extra <tt>AS</tt> was removed from the generated <span class="caps">SQL</span> for <tt>has_and_belongs_to_many</tt> preloading, making it work better for some databases.</li>
281
+ <li><tt>ActiveRecord::Base#new_record?</tt> now returns <tt>false</tt> rather than <tt>nil</tt> when confronted with an existing record.</li>
282
+ <li>A bug in quoting table names in some <tt>has_many :through</tt> associations was fixed.</li>
283
+ <li>You can now specify a particular timestamp for <tt>updated_at</tt> timestamps: <tt>cust = Customer.create(:name => "ABC Industries", :updated_at => 1.day.ago)</tt></li>
284
+ <li>Better error messages on failed <tt>find_by_attribute!</tt> calls.</li>
285
+ <li>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.</li>
286
+ <li>A bug in canceling callbacks from <tt>before_update</tt> or <tt>before_create</tt> was fixed.</li>
287
+ <li>Rake tasks for testing databases via <span class="caps">JDBC</span> have been added.</li>
288
+ <li><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).</li>
289
+ <li>Counts on scoped selects now work properly, so you can do things like <tt>Account.scoped(:select => "DISTINCT credit_limit").count</tt>.</li>
290
+ <li><tt>ActiveRecord::Base#invalid?</tt> now works as the opposite of <tt>ActiveRecord::Base#valid?</tt>.</li>
291
+ </ul>
292
+ <h3 id="action-controller">5 Action Controller</h3>
293
+ <p>Action Controller rolls out some significant changes to rendering, as well as improvements in routing and other areas, in this release.</p>
294
+ <h4 id="unified-rendering">5.1 Unified Rendering</h4>
295
+ <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>
296
+ <div class="code_container">
297
+ <pre class="brush: ruby; gutter: false; toolbar: false">
298
+ render :file =&gt; '/tmp/random_file.erb'
299
+ render :template =&gt; 'other_controller/action'
300
+ render :action =&gt; 'show'
301
+ </pre>
302
+ </div>
303
+ <p>Now in Rails 2.3, you can just supply what you want to render:</p>
304
+ <div class="code_container">
305
+ <pre class="brush: ruby; gutter: false; toolbar: false">
306
+ render '/tmp/random_file.erb'
307
+ render 'other_controller/action'
308
+ render 'show'
309
+ render :show
310
+ </pre>
311
+ </div>
312
+ <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>
313
+ <h4 id="application-controller-renamed">5.2 Application Controller Renamed</h4>
314
+ <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 &#8211; and it will be run as part of the normal <tt>rake rails:update</tt> process.</p>
315
+ <ul>
316
+ <li>More Information:
317
+ <ul>
318
+ <li><a href="http://afreshcup.com/2008/11/17/rails-2x-the-death-of-applicationrb/">The Death of Application.rb</a></li>
319
+ <li><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></li>
320
+ </ul></li>
321
+ </ul>
322
+ <h4 id="http-digest-authentication-support">5.3 <span class="caps">HTTP</span> Digest Authentication Support</h4>
323
+ <p>Rails now has built-in support for <span class="caps">HTTP</span> 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>
324
+ <div class="code_container">
325
+ <pre class="brush: ruby; gutter: false; toolbar: false">
326
+ class PostsController &lt; ApplicationController
327
+ Users = {&quot;dhh&quot; =&gt; &quot;secret&quot;}
328
+ before_filter :authenticate
329
+
330
+ def secret
331
+ render :text =&gt; &quot;Password Required!&quot;
332
+ end
333
+
334
+ private
335
+ def authenticate
336
+ realm = &quot;Application&quot;
337
+ authenticate_or_request_with_http_digest(realm) do |name|
338
+ Users[name]
339
+ end
340
+ end
341
+ end
342
+ </pre>
343
+ </div>
344
+ <ul>
345
+ <li>Lead Contributor: <a href="http://www.kellogg-assoc.com/">Gregg Kellogg</a></li>
346
+ <li>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: <span class="caps">HTTP</span> Digest Authentication</a></li>
347
+ </ul>
348
+ <h4 id="more-efficient-routing">5.4 More Efficient Routing</h4>
349
+ <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 &#8211; 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 &#8211; 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 <tt>routes.rb</tt>. You can use <tt>RouteSet#add_configuration_file</tt> to bring in more routes at any time &#8211; 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>
350
+ <ul>
351
+ <li>Lead Contributors: <a href="http://blog.hungrymachine.com/">Aaron Batalion</a></li>
352
+ </ul>
353
+ <h4 id="rack-based-lazy-loaded-sessions">5.5 Rack-based Lazy-loaded Sessions</h4>
354
+ <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 <span class="caps">CGI</span> 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>
355
+ <h4 id="mime-type-handling-changes">5.6 <span class="caps">MIME</span> Type Handling Changes</h4>
356
+ <p>There are a couple of changes to the code for handling <span class="caps">MIME</span> 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>
357
+ <div class="code_container">
358
+ <pre class="brush: ruby; gutter: false; toolbar: false">
359
+ if content_type &amp;&amp; Mime::JS =~ content_type
360
+ # do something cool
361
+ end
362
+
363
+ Mime::JS =~ &quot;text/javascript&quot; =&gt; true
364
+ Mime::JS =~ &quot;application/javascript&quot; =&gt; true
365
+ </pre>
366
+ </div>
367
+ <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>
368
+ <ul>
369
+ <li>Lead Contributor: <a href="http://www.workingwithrails.com/person/5510-seth-fitzsimmons">Seth Fitzsimmons</a></li>
370
+ </ul>
371
+ <h4 id="optimization-of-respond_to">5.7 Optimization of <tt>respond_to</tt></h4>
372
+ <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 <span class="caps">MIME</span> 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>
373
+ <h4 id="improved-caching-performance">5.8 Improved Caching Performance</h4>
374
+ <p>Rails now keeps a per-request local cache of read from the remote cache stores, 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>
375
+ <ul>
376
+ <li>Lead Contributor: <a href="http://www.motionstandingstill.com/">Nahum Wild</a></li>
377
+ </ul>
378
+ <h4 id="localized-views">5.9 Localized Views</h4>
379
+ <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>
380
+ <p>In addition, you can use the same scheme to localize the rescue files in the <tt>public</tt> directory: <tt>public/500.da.html</tt> or <tt>public/404.en.html</tt> work, for example.</p>
381
+ <h4 id="partial-scoping-for-translations">5.10 Partial Scoping for Translations</h4>
382
+ <p>A change to the translation <span class="caps">API</span> makes things easier and less repetitive to write key translations within partials. If you call <tt>translate(".foo")</tt> from the <tt>people/index.html.erb</tt> template, you&#8217;ll actually be calling <tt>I18n.translate("people.index.foo")</tt> If you don&#8217;t prepend the key with a period, then the <span class="caps">API</span> doesn&#8217;t scope, just as before.</p>
383
+ <h4 id="other-action-controller-changes">5.11 Other Action Controller Changes</h4>
384
+ <ul>
385
+ <li>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>.</li>
386
+ <li>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.</li>
387
+ <li><tt>ActionController::Dispatcher</tt> now implements its own middleware stack, which you can see by running <tt>rake middleware</tt>.</li>
388
+ <li>Cookie sessions now have persistent session identifiers, with <span class="caps">API</span> compatibility with the server-side stores.</li>
389
+ <li>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 => :png)</tt>.</li>
390
+ <li>The <tt>:only</tt> and <tt>:except</tt> options for <tt>map.resources</tt> are no longer inherited by nested resources.</li>
391
+ <li>The bundled memcached client has been updated to version 1.6.4.99.</li>
392
+ <li>The <tt>expires_in</tt>, <tt>stale?</tt>, and <tt>fresh_when</tt> methods now accept a <tt>:public</tt> option to make them work well with proxy caching.</li>
393
+ <li>The <tt>:requirements</tt> option now works properly with additional RESTful member routes.</li>
394
+ <li>Shallow routes now properly respect namespaces.</li>
395
+ <li><tt>polymorphic_url</tt> does a better job of handling objects with irregular plural names.</li>
396
+ </ul>
397
+ <h3 id="action-view">6 Action View</h3>
398
+ <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>
399
+ <h4 id="nested-object-forms">6.1 Nested Object Forms</h4>
400
+ <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>
401
+ <div class="code_container">
402
+ <pre class="brush: ruby; gutter: false; toolbar: false">
403
+ class Customer &lt; ActiveRecord::Base
404
+ has_many :orders
405
+
406
+ accepts_nested_attributes_for :orders, :allow_destroy =&gt; true
407
+ end
408
+ </pre>
409
+ </div>
410
+ <p>You can write this view in Rails 2.3:</p>
411
+ <div class="code_container">
412
+ <pre class="brush: ruby; html-script: true; gutter: false; toolbar: false">
413
+ &lt;% form_for @customer do |customer_form| %&gt;
414
+ &lt;div&gt;
415
+ &lt;%= customer_form.label :name, 'Customer Name:' %&gt;
416
+ &lt;%= customer_form.text_field :name %&gt;
417
+ &lt;/div&gt;
418
+
419
+ &lt;!-- Here we call fields_for on the customer_form builder instance.
420
+ The block is called for each member of the orders collection. --&gt;
421
+ &lt;% customer_form.fields_for :orders do |order_form| %&gt;
422
+ &lt;p&gt;
423
+ &lt;div&gt;
424
+ &lt;%= order_form.label :number, 'Order Number:' %&gt;
425
+ &lt;%= order_form.text_field :number %&gt;
426
+ &lt;/div&gt;
427
+
428
+ &lt;!-- The allow_destroy option in the model enables deletion of
429
+ child records. --&gt;
430
+ &lt;% unless order_form.object.new_record? %&gt;
431
+ &lt;div&gt;
432
+ &lt;%= order_form.label :_delete, 'Remove:' %&gt;
433
+ &lt;%= order_form.check_box :_delete %&gt;
434
+ &lt;/div&gt;
435
+ &lt;% end %&gt;
436
+ &lt;/p&gt;
437
+ &lt;% end %&gt;
438
+
439
+ &lt;%= customer_form.submit %&gt;
440
+ &lt;% end %&gt;
441
+ </pre>
442
+ </div>
443
+ <ul>
444
+ <li>Lead Contributor: <a href="http://superalloy.nl/">Eloy Duran</a></li>
445
+ <li>More Information:
446
+ <ul>
447
+ <li><a href="http://weblog.rubyonrails.org/2009/1/26/nested-model-forms">Nested Model Forms</a></li>
448
+ <li><a href="http://github.com/alloy/complex-form-examples">complex-form-examples</a></li>
449
+ <li><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></li>
450
+ </ul></li>
451
+ </ul>
452
+ <h4 id="smart-rendering-of-partials">6.2 Smart Rendering of Partials</h4>
453
+ <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>
454
+ <div class="code_container">
455
+ <pre class="brush: ruby; gutter: false; toolbar: false">
456
+ # Equivalent of render :partial =&gt; 'articles/_article',
457
+ # :object =&gt; @article
458
+ render @article
459
+
460
+ # Equivalent of render :partial =&gt; 'articles/_article',
461
+ # :collection =&gt; @articles
462
+ render @articles
463
+ </pre>
464
+ </div>
465
+ <ul>
466
+ <li>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></li>
467
+ </ul>
468
+ <h4 id="prompts-for-date-select-helpers">6.3 Prompts for Date Select Helpers</h4>
469
+ <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>
470
+ <div class="code_container">
471
+ <pre class="brush: ruby; gutter: false; toolbar: false">
472
+ select_datetime(DateTime.now, :prompt =&gt; true)
473
+
474
+ select_datetime(DateTime.now, :prompt =&gt; &quot;Choose date and time&quot;)
475
+
476
+ select_datetime(DateTime.now, :prompt =&gt;
477
+ {:day =&gt; 'Choose day', :month =&gt; 'Choose month',
478
+ :year =&gt; 'Choose year', :hour =&gt; 'Choose hour',
479
+ :minute =&gt; 'Choose minute'})
480
+ </pre>
481
+ </div>
482
+ <ul>
483
+ <li>Lead Contributor: <a href="http://samoliver.com/">Sam Oliver</a></li>
484
+ </ul>
485
+ <h4 id="assettag-timestamp-caching">6.4 AssetTag Timestamp Caching</h4>
486
+ <p>You&#8217;re likely familiar with Rails&#8217; practice of adding timestamps to static asset paths as a &#8220;cache buster.&#8221; 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 &#8211; 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>
487
+ <h4 id="asset-hosts-as-objects">6.5 Asset Hosts as Objects</h4>
488
+ <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 implement any complex logic you need in your asset hosting.</p>
489
+ <ul>
490
+ <li>More Information: <a href="http://github.com/dhh/asset-hosting-with-minimum-ssl/tree/master">asset-hosting-with-minimum-ssl</a></li>
491
+ </ul>
492
+ <h4 id="grouped_options_for_select-helper-method">6.6 grouped_options_for_select Helper Method</h4>
493
+ <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>
494
+ <div class="code_container">
495
+ <pre class="brush: ruby; gutter: false; toolbar: false">
496
+ grouped_options_for_select([[&quot;Hats&quot;, [&quot;Baseball Cap&quot;,&quot;Cowboy Hat&quot;]]],
497
+ &quot;Cowboy Hat&quot;, &quot;Choose a product...&quot;)
498
+ </pre>
499
+ </div>
500
+ <p>returns</p>
501
+ <div class="code_container">
502
+ <pre class="brush: ruby; gutter: false; toolbar: false">
503
+ &lt;option value=&quot;&quot;&gt;Choose a product...&lt;/option&gt;
504
+ &lt;optgroup label=&quot;Hats&quot;&gt;
505
+ &lt;option value=&quot;Baseball Cap&quot;&gt;Baseball Cap&lt;/option&gt;
506
+ &lt;option selected=&quot;selected&quot; value=&quot;Cowboy Hat&quot;&gt;Cowboy Hat&lt;/option&gt;
507
+ &lt;/optgroup&gt;
508
+ </pre>
509
+ </div>
510
+ <h4 id="disabled-option-tags-for-form-select-helpers">6.7 Disabled Option Tags for Form Select Helpers</h4>
511
+ <p>The form select helpers (such as <tt>select</tt> and <tt>options_for_select</tt>) now support a <tt>:disabled</tt> option, which can take a single value or an array of values to be disabled in the resulting tags:</p>
512
+ <div class="code_container">
513
+ <pre class="brush: ruby; gutter: false; toolbar: false">
514
+ select(:post, :category, Post::CATEGORIES, :disabled =&gt; ‘private‘)
515
+ </pre>
516
+ </div>
517
+ <p>returns</p>
518
+ <div class="code_container">
519
+ <pre class="brush: ruby; gutter: false; toolbar: false">
520
+ &lt;select name=“post[category]“&gt;
521
+ &lt;option&gt;story&lt;/option&gt;
522
+ &lt;option&gt;joke&lt;/option&gt;
523
+ &lt;option&gt;poem&lt;/option&gt;
524
+ &lt;option disabled=“disabled“&gt;private&lt;/option&gt;
525
+ &lt;/select&gt;
526
+ </pre>
527
+ </div>
528
+ <p>You can also use an anonymous function to determine at runtime which options from collections will be selected and/or disabled:</p>
529
+ <div class="code_container">
530
+ <pre class="brush: ruby; gutter: false; toolbar: false">
531
+ options_from_collection_for_select(@product.sizes, :name, :id, :disabled =&gt; lambda{|size| size.out_of_stock?})
532
+ </pre>
533
+ </div>
534
+ <ul>
535
+ <li>Lead Contributor: <a href="http://tekin.co.uk/">Tekin Suleyman</a></li>
536
+ <li>More Information: <a href="http://tekin.co.uk/2009/03/new-in-rails-23-disabled-option-tags-and-lambdas-for-selecting-and-disabling-options-from-collections/">New in rails 2.3 &#8211; disabled option tags and lambdas for selecting and disabling options from collections</a></li>
537
+ </ul>
538
+ <h4 id="a-note-about-template-loading">6.8 A Note About Template Loading</h4>
539
+ <p>Rails 2.3 includes the ability to enable or disable cached templates for any particular environment. Cached templates give you a speed boost because they don&#8217;t check for a new template file when they&#8217;re rendered &#8211; but they also mean that you can&#8217;t replace a template &#8220;on the fly&#8221; without restarting the server.</p>
540
+ <p>In most cases, you&#8217;ll want template caching to be turned on in production, which you can do by making a setting in your <tt>production.rb</tt> file:</p>
541
+ <div class="code_container">
542
+ <pre class="brush: ruby; gutter: false; toolbar: false">
543
+ config.action_view.cache_template_loading = true
544
+ </pre>
545
+ </div>
546
+ <p>This line will be generated for you by default in a new Rails 2.3 application. If you&#8217;ve upgraded from an older version of Rails, Rails will default to caching templates in production and test but not in development.</p>
547
+ <h4 id="other-action-view-changes">6.9 Other Action View Changes</h4>
548
+ <ul>
549
+ <li>Token generation for <span class="caps">CSRF</span> protection has been simplified; now Rails uses a simple random string generated by <tt>ActiveSupport::SecureRandom</tt> rather than mucking around with session IDs.</li>
550
+ <li><tt>auto_link</tt> now properly applies options (such as <tt>:target</tt> and <tt>:class</tt>) to generated e-mail links.</li>
551
+ <li>The <tt>autolink</tt> helper has been refactored to make it a bit less messy and more intuitive.</li>
552
+ <li><tt>current_page?</tt> now works properly even when there are multiple query parameters in the <span class="caps">URL</span>.</li>
553
+ </ul>
554
+ <h3 id="active-support">7 Active Support</h3>
555
+ <p>Active Support has a few interesting changes, including the introduction of <tt>Object#try</tt>.</p>
556
+ <h4 id="object-try">7.1 Object#try</h4>
557
+ <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>
558
+ <ul>
559
+ <li>More Information: <a href="http://ozmm.org/posts/try.html" title="">try</a>.</li>
560
+ </ul>
561
+ <h4 id="object-tap-backport">7.2 Object#tap Backport</h4>
562
+ <p><tt>Object#tap</tt> is an addition to <a href="http://www.ruby-doc.org/core-1.9/classes/Object.html#M000309">Ruby 1.9</a> 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>
563
+ <h4 id="swappable-parsers-for-xmlmini">7.3 Swappable Parsers for XMLmini</h4>
564
+ <p>The support for <span class="caps">XML</span> parsing in ActiveSupport has been made more flexible by allowing you to swap in different parsers. By default, it uses the standard <span class="caps">REXML</span> implementation, but you can easily specify the faster LibXML or Nokogiri implementations for your own applications, provided you have the appropriate gems installed:</p>
565
+ <div class="code_container">
566
+ <pre class="brush: ruby; gutter: false; toolbar: false">
567
+ XmlMini.backend = 'LibXML'
568
+ </pre>
569
+ </div>
570
+ <ul>
571
+ <li>Lead Contributor: <a href="http://www.movesonrails.com/">Bart ten Brinke</a></li>
572
+ <li>Lead Contributor: <a href="http://tenderlovemaking.com/">Aaron Patterson</a></li>
573
+ </ul>
574
+ <h4 id="fractional-seconds-for-timewithzone">7.4 Fractional seconds for TimeWithZone</h4>
575
+ <p>The <tt>Time</tt> and <tt>TimeWithZone</tt> classes include an <tt>xmlschema</tt> method to return the time in an <span class="caps">XML</span>-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>
576
+ <div class="code_container">
577
+ <pre class="brush: ruby; gutter: false; toolbar: false">
578
+ &gt;&gt; Time.zone.now.xmlschema(6)
579
+ =&gt; &quot;2009-01-16T13:00:06.13653Z&quot;
580
+ </pre>
581
+ </div>
582
+ <ul>
583
+ <li>Lead Contributor: <a href="http://www.workingwithrails.com/person/13536-nicholas-dainty">Nicholas Dainty</a></li>
584
+ </ul>
585
+ <h4 id="json-key-quoting">7.5 <span class="caps">JSON</span> Key Quoting</h4>
586
+ <p>If you look up the spec on the &#8220;json.org&#8221; site, you&#8217;ll discover that all keys in a <span class="caps">JSON</span> structure must be strings, and they must be quoted with double quotes. Starting with Rails 2.3, we do the right thing here, even with numeric keys.</p>
587
+ <h4 id="other-active-support-changes">7.6 Other Active Support Changes</h4>
588
+ <ul>
589
+ <li>You can use <tt>Enumerable#none?</tt> to check that none of the elements match the supplied block.</li>
590
+ <li>If you&#8217;re using Active Support <a href="http://afreshcup.com/2008/10/19/coming-in-rails-22-delegate-prefixes/">delegates</a>, the new <tt>:allow_nil</tt> option lets you return <tt>nil</tt> instead of raising an exception when the target object is nil.</li>
591
+ <li><tt>ActiveSupport::OrderedHash</tt>: now implements <tt>each_key</tt> and <tt>each_value</tt>.</li>
592
+ <li><tt>ActiveSupport::MessageEncryptor</tt> provides a simple way to encrypt information for storage in an untrusted location (like cookies).</li>
593
+ <li>Active Support&#8217;s <tt>from_xml</tt> no longer depends on XmlSimple. Instead, Rails now includes its own XmlMini implementation, with just the functionality that it requires. This lets Rails dispense with the bundled copy of XmlSimple that it&#8217;s been carting around.</li>
594
+ <li>If you memoize a private method, the result will now be private.</li>
595
+ <li><tt>String#parameterize</tt> accepts an optional separator: <tt>"Quick Brown Fox".parameterize('_') => "quick_brown_fox"</tt>.</li>
596
+ <li><tt>number_to_phone</tt> accepts 7-digit phone numbers now.</li>
597
+ <li><tt>ActiveSupport::Json.decode</tt> now handles <tt>\u0000</tt> style escape sequences.</li>
598
+ </ul>
599
+ <h3 id="railties">8 Railties</h3>
600
+ <p>In addition to the Rack changes covered above, Railties (the core code of Rails itself) sports a number of significant changes, including Rails Metal, application templates, and quiet backtraces.</p>
601
+ <h4 id="rails-metal">8.1 Rails Metal</h4>
602
+ <p>Rails Metal is a new mechanism that provides superfast endpoints inside of your Rails applications. Metal classes bypass routing and Action Controller to give you raw speed (at the cost of all the things in Action Controller, of course). This builds on all of the recent foundation work to make Rails a Rack application with an exposed middleware stack. Metal endpoints can be loaded from your application or from plugins.</p>
603
+ <ul>
604
+ <li>More Information:
605
+ <ul>
606
+ <li><a href="http://weblog.rubyonrails.org/2008/12/17/introducing-rails-metal">Introducing Rails Metal</a></li>
607
+ <li><a href="http://soylentfoo.jnewland.com/articles/2008/12/16/rails-metal-a-micro-framework-with-the-power-of-rails-m">Rails Metal: a micro-framework with the power of Rails</a></li>
608
+ <li><a href="http://www.railsinside.com/deployment/180-metal-super-fast-endpoints-within-your-rails-apps.html">Metal: Super-fast Endpoints within your Rails Apps</a></li>
609
+ <li><a href="http://ryandaigle.com/articles/2008/12/18/what-s-new-in-edge-rails-rails-metal">What&#8217;s New in Edge Rails: Rails Metal</a></li>
610
+ </ul></li>
611
+ </ul>
612
+ <h4 id="application-templates">8.2 Application Templates</h4>
613
+ <p>Rails 2.3 incorporates Jeremy McAnally&#8217;s <a href="http://github.com/jeremymcanally/rg/tree/master">rg</a> application generator. What this means is that we now have template-based application generation built right into Rails; if you have a set of plugins you include in every application (among many other use cases), you can just set up a template once and use it over and over again when you run the <tt>rails</tt> command. There&#8217;s also a rake task to apply a template to an existing application:</p>
614
+ <div class="code_container">
615
+ <pre class="brush: ruby; gutter: false; toolbar: false">
616
+ rake rails:template LOCATION=~/template.rb
617
+ </pre>
618
+ </div>
619
+ <p>This will layer the changes from the template on top of whatever code the project already contains.</p>
620
+ <ul>
621
+ <li>Lead Contributor: <a href="http://www.jeremymcanally.com/">Jeremy McAnally</a></li>
622
+ <li>More Info:<a href="http://m.onkey.org/2008/12/4/rails-templates">Rails templates</a></li>
623
+ </ul>
624
+ <h4 id="quieter-backtraces">8.3 Quieter Backtraces</h4>
625
+ <p>Building on Thoughtbot&#8217;s <a href="http://www.thoughtbot.com/projects/quietbacktrace">Quiet Backtrace</a> plugin, which allows you to selectively remove lines from <tt>Test::Unit</tt> backtraces, Rails 2.3 implements <tt>ActiveSupport::BacktraceCleaner</tt> and <tt>Rails::BacktraceCleaner</tt> in core. This supports both filters (to perform regex-based substitutions on backtrace lines) and silencers (to remove backtrace lines entirely). Rails automatically adds silencers to get rid of the most common noise in a new application, and builds a <tt>config/backtrace_silencers.rb</tt> file to hold your own additions. This feature also enables prettier printing from any gem in the backtrace.</p>
626
+ <h4 id="faster-boot-time-in-development-mode-with-lazy-loading-autoload">8.4 Faster Boot Time in Development Mode with Lazy Loading/Autoload</h4>
627
+ <p>Quite a bit of work was done to make sure that bits of Rails (and its dependencies) are only brought into memory when they&#8217;re actually needed. The core frameworks &#8211; Active Support, Active Record, Action Controller, Action Mailer and Action View &#8211; are now using <tt>autoload</tt> to lazy-load their individual classes. This work should help keep the memory footprint down and improve overall Rails performance.</p>
628
+ <p>You can also specify (by using the new <tt>preload_frameworks</tt> option) whether the core libraries should be autoloaded at startup. This defaults to <tt>false</tt> so that Rails autoloads itself piece-by-piece, but there are some circumstances where you still need to bring in everything at once &#8211; Passenger and JRuby both want to see all of Rails loaded together.</p>
629
+ <h4 id="rake-gem-task-rewrite">8.5 rake gem Task Rewrite</h4>
630
+ <p>The internals of the various <code>rake gem</code> tasks have been substantially revised, to make the system work better for a variety of cases. The gem system now knows the difference between development and runtime dependencies, has a more robust unpacking system, gives better information when querying for the status of gems, and is less prone to &#8220;chicken and egg&#8221; dependency issues when you&#8217;re bringing things up from scratch. There are also fixes for using gem commands under JRuby and for dependencies that try to bring in external copies of gems that are already vendored.</p>
631
+ <ul>
632
+ <li>Lead Contributor: <a href="http://www.workingwithrails.com/person/12240-david-dollar">David Dollar</a></li>
633
+ </ul>
634
+ <h4 id="other-railties-changes">8.6 Other Railties Changes</h4>
635
+ <ul>
636
+ <li>The instructions for updating a CI server to build Rails have been updated and expanded.</li>
637
+ <li>Internal Rails testing has been switched from <tt>Test::Unit::TestCase</tt> to <tt>ActiveSupport::TestCase</tt>, and the Rails core requires Mocha to test.</li>
638
+ <li>The default <tt>environment.rb</tt> file has been decluttered.</li>
639
+ <li>The dbconsole script now lets you use an all-numeric password without crashing.</li>
640
+ <li><tt>Rails.root</tt> now returns a <tt>Pathname</tt> object, which means you can use it directly with the <tt>join</tt> method to <a href="http://afreshcup.com/2008/12/05/a-little-rails_root-tidiness/">clean up existing code</a> that uses <tt>File.join</tt>.</li>
641
+ <li>Various files in /public that deal with <span class="caps">CGI</span> and <span class="caps">FCGI</span> dispatching are no longer generated in every Rails application by default (you can still get them if you need them by adding <tt>--with-dispatchers</tt> when you run the <tt>rails</tt> command, or add them later with <tt>rake rails:update:generate_dispatchers</tt>).</li>
642
+ <li>Rails Guides have been converted from AsciiDoc to Textile markup.</li>
643
+ <li>Scaffolded views and controllers have been cleaned up a bit.</li>
644
+ <li><tt>script/server</tt> now accepts a <tt>&#8212;path</tt> argument to mount a Rails application from a specific path.</li>
645
+ <li>If any configured gems are missing, the gem rake tasks will skip loading much of the environment. This should solve many of the &#8220;chicken-and-egg&#8221; problems where rake gems:install couldn&#8217;t run because gems were missing.</li>
646
+ <li>Gems are now unpacked exactly once. This fixes issues with gems (hoe, for instance) which are packed with read-only permissions on the files.</li>
647
+ </ul>
648
+ <h3 id="deprecated">9 Deprecated</h3>
649
+ <p>A few pieces of older code are deprecated in this release:</p>
650
+ <ul>
651
+ <li>If you&#8217;re one of the (fairly rare) Rails developers who deploys in a fashion that depends on the inspector, reaper, and spawner scripts, you&#8217;ll need to know that those scripts are no longer included in core Rails. If you need them, you&#8217;ll be able to pick up copies via the <a href="http://github.com/rails/irs_process_scripts/tree">irs_process_scripts</a> plugin.</li>
652
+ <li><tt>render_component</tt> goes from &#8220;deprecated&#8221; to &#8220;nonexistent&#8221; in Rails 2.3. If you still need it, you can install the <a href="http://github.com/rails/render_component/tree/master">render_component plugin</a>.</li>
653
+ <li>Support for Rails components has been removed.</li>
654
+ <li>If you were one of the people who got used to running <tt>script/performance/request</tt> to look at performance based on integration tests, you need to learn a new trick: that script has been removed from core Rails now. There’s a new request_profiler plugin that you can install to get the exact same functionality back.</li>
655
+ <li><tt>ActionController::Base#session_enabled?</tt> is deprecated because sessions are lazy-loaded now.</li>
656
+ <li>The <tt>:digest</tt> and <tt>:secret</tt> options to <tt>protect_from_forgery</tt> are deprecated and have no effect.</li>
657
+ <li>Some integration test helpers have been removed. <tt>response.headers["Status"]</tt> and <tt>headers["Status"]</tt> will no longer return anything. Rack does not allow &#8220;Status&#8221; in its return headers. However you can still use the <tt>status</tt> and <tt>status_message</tt> helpers. <tt>response.headers["cookie"]</tt> and <tt>headers["cookie"]</tt> will no longer return any <span class="caps">CGI</span> cookies. You can inspect <tt>headers["Set-Cookie"]</tt> to see the raw cookie header or use the <tt>cookies</tt> helper to get a hash of the cookies sent to the client.</li>
658
+ <li><tt>formatted_polymorphic_url</tt> is deprecated. Use <tt>polymorphic_url</tt> with <tt>:format</tt> instead.</li>
659
+ <li>The <tt>:http_only</tt> option in <tt>ActionController::Response#set_cookie</tt> has been renamed to <tt>:httponly</tt>.</li>
660
+ <li>The <tt>:connector</tt> and <tt>:skip_last_comma</tt> options of <tt>to_sentence</tt> have been replaced by <tt>:words_connnector</tt>, <tt>:two_words_connector</tt>, and <tt>:last_word_connector</tt> options.</li>
661
+ <li>Posting a multipart form with an empty <tt>file_field</tt> control used to submit an empty string to the controller. Now it submits a nil, due to differences between Rack&#8217;s multipart parser and the old Rails one.</li>
662
+ </ul>
663
+ <h3 id="credits">10 Credits</h3>
664
+ <p>Release notes compiled by <a href="http://afreshcup.com">Mike Gunderloy</a>. This version of the Rails 2.3 release notes was compiled based on RC2 of Rails 2.3.</p>
665
+
666
+ <h3>Feedback</h3>
667
+ <p>
668
+ You're encouraged to help improve the quality of this guide.
669
+ </p>
670
+ <p>
671
+ If you see any typos or factual errors you are confident to
672
+ patch, please clone <a href="https://github.com/lifo/docrails">docrails</a>
673
+ and push the change yourself. That branch of Rails has public write access.
674
+ Commits are still reviewed, but that happens after you've submitted your
675
+ contribution. <a href="https://github.com/lifo/docrails">docrails</a> is
676
+ cross-merged with master periodically.
677
+ </p>
678
+ <p>
679
+ You may also find incomplete content, or stuff that is not up to date.
680
+ Please do add any missing documentation for master. Check the
681
+ <a href="ruby_on_rails_guides_guidelines.html">Ruby on Rails Guides Guidelines</a>
682
+ for style and conventions.
683
+ </p>
684
+ <p>
685
+ If for whatever reason you spot something to fix but cannot patch it yourself, please
686
+ <a href="https://github.com/rails/rails/issues">open an issue</a>.
687
+ </p>
688
+ <p>And last but not least, any kind of discussion regarding Ruby on Rails
689
+ documentation is very welcome in the <a href="http://groups.google.com/group/rubyonrails-docs">rubyonrails-docs mailing list</a>.
690
+ </p>
691
+ </div>
692
+ </div>
693
+ </div>
694
+
695
+ <hr class="hide" />
696
+ <div id="footer">
697
+ <div class="wrapper">
698
+ <p>This work is licensed under a <a href="http://creativecommons.org/licenses/by-sa/3.0/">Creative Commons Attribution-Share Alike 3.0</a> License</p>
699
+ <p>"Rails", "Ruby on Rails", and the Rails logo are trademarks of David Heinemeier Hansson. All rights reserved.</p>
700
+ </div>
701
+ </div>
702
+
703
+ <script type="text/javascript" src="javascripts/guides.js"></script>
704
+ <script type="text/javascript" src="javascripts/syntaxhighlighter/shCore.js"></script>
705
+ <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushRuby.js"></script>
706
+ <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushXml.js"></script>
707
+ <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushSql.js"></script>
708
+ <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushPlain.js"></script>
709
+ <script type="text/javascript">
710
+ SyntaxHighlighter.all()
711
+ </script>
712
+ </body>
713
+ </html>