rails 4.2.0.beta3 → 4.2.0.beta4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (227) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +9 -7
  3. data/guides/output/2_2_release_notes.html +724 -0
  4. data/guides/output/2_3_release_notes.html +870 -0
  5. data/guides/output/3_0_release_notes.html +773 -0
  6. data/guides/output/3_1_release_notes.html +740 -0
  7. data/guides/output/3_2_release_notes.html +797 -0
  8. data/guides/output/4_0_release_notes.html +523 -0
  9. data/guides/output/4_1_release_notes.html +806 -0
  10. data/guides/output/4_2_release_notes.html +728 -0
  11. data/guides/output/Gemfile +6 -0
  12. data/guides/output/_license.html +226 -0
  13. data/guides/output/_welcome.html +233 -0
  14. data/guides/output/action_controller_overview.html +1335 -0
  15. data/guides/output/action_mailer_basics.html +928 -0
  16. data/guides/output/action_view_overview.html +1509 -0
  17. data/guides/output/active_job_basics.html +546 -0
  18. data/guides/output/active_model_basics.html +438 -0
  19. data/guides/output/active_record_basics.html +594 -0
  20. data/guides/output/active_record_callbacks.html +592 -0
  21. data/guides/output/active_record_migrations.html +1123 -0
  22. data/guides/output/active_record_postgresql.html +675 -0
  23. data/guides/output/active_record_querying.html +1796 -0
  24. data/guides/output/active_record_validations.html +1301 -0
  25. data/guides/output/active_support_core_extensions.html +3450 -0
  26. data/guides/output/active_support_instrumentation.html +1121 -0
  27. data/guides/output/api_documentation_guidelines.html +498 -0
  28. data/guides/output/asset_pipeline.html +1167 -0
  29. data/guides/output/association_basics.html +2086 -0
  30. data/guides/output/caching_with_rails.html +553 -0
  31. data/guides/output/command_line.html +791 -0
  32. data/guides/output/configuring.html +1055 -0
  33. data/guides/output/contributing_to_ruby_on_rails.html +657 -0
  34. data/guides/output/credits.html +284 -0
  35. data/guides/output/debugging_rails_applications.html +1014 -0
  36. data/guides/output/development_dependencies_install.html +478 -0
  37. data/guides/output/engines.html +1438 -0
  38. data/guides/output/form_helpers.html +1074 -0
  39. data/guides/output/generators.html +838 -0
  40. data/guides/output/getting_started.html +2092 -0
  41. data/guides/output/i18n.html +1198 -0
  42. data/guides/output/images/akshaysurve.jpg +0 -0
  43. data/guides/output/images/belongs_to.png +0 -0
  44. data/guides/output/images/book_icon.gif +0 -0
  45. data/guides/output/images/bullet.gif +0 -0
  46. data/guides/output/images/chapters_icon.gif +0 -0
  47. data/guides/output/images/check_bullet.gif +0 -0
  48. data/guides/output/images/credits_pic_blank.gif +0 -0
  49. data/guides/output/images/csrf.png +0 -0
  50. data/guides/output/images/edge_badge.png +0 -0
  51. data/guides/output/images/favicon.ico +0 -0
  52. data/guides/output/images/feature_tile.gif +0 -0
  53. data/guides/output/images/footer_tile.gif +0 -0
  54. data/guides/output/images/fxn.png +0 -0
  55. data/guides/output/images/getting_started/article_with_comments.png +0 -0
  56. data/guides/output/images/getting_started/challenge.png +0 -0
  57. data/guides/output/images/getting_started/confirm_dialog.png +0 -0
  58. data/guides/output/images/getting_started/forbidden_attributes_for_new_article.png +0 -0
  59. data/guides/output/images/getting_started/forbidden_attributes_for_new_post.png +0 -0
  60. data/guides/output/images/getting_started/form_with_errors.png +0 -0
  61. data/guides/output/images/getting_started/index_action_with_edit_link.png +0 -0
  62. data/guides/output/images/getting_started/new_article.png +0 -0
  63. data/guides/output/images/getting_started/new_post.png +0 -0
  64. data/guides/output/images/getting_started/post_with_comments.png +0 -0
  65. data/guides/output/images/getting_started/rails_welcome.png +0 -0
  66. data/guides/output/images/getting_started/routing_error_no_controller.png +0 -0
  67. data/guides/output/images/getting_started/routing_error_no_route_matches.png +0 -0
  68. data/guides/output/images/getting_started/show_action_for_articles.png +0 -0
  69. data/guides/output/images/getting_started/show_action_for_posts.png +0 -0
  70. data/guides/output/images/getting_started/template_is_missing_articles_new.png +0 -0
  71. data/guides/output/images/getting_started/template_is_missing_posts_new.png +0 -0
  72. data/guides/output/images/getting_started/undefined_method_post_path.png +0 -0
  73. data/guides/output/images/getting_started/unknown_action_create_for_articles.png +0 -0
  74. data/guides/output/images/getting_started/unknown_action_create_for_posts.png +0 -0
  75. data/guides/output/images/getting_started/unknown_action_new_for_articles.png +0 -0
  76. data/guides/output/images/getting_started/unknown_action_new_for_posts.png +0 -0
  77. data/guides/output/images/grey_bullet.gif +0 -0
  78. data/guides/output/images/habtm.png +0 -0
  79. data/guides/output/images/has_many.png +0 -0
  80. data/guides/output/images/has_many_through.png +0 -0
  81. data/guides/output/images/has_one.png +0 -0
  82. data/guides/output/images/has_one_through.png +0 -0
  83. data/guides/output/images/header_backdrop.png +0 -0
  84. data/guides/output/images/header_tile.gif +0 -0
  85. data/guides/output/images/i18n/demo_html_safe.png +0 -0
  86. data/guides/output/images/i18n/demo_localized_pirate.png +0 -0
  87. data/guides/output/images/i18n/demo_translated_en.png +0 -0
  88. data/guides/output/images/i18n/demo_translated_pirate.png +0 -0
  89. data/guides/output/images/i18n/demo_translation_missing.png +0 -0
  90. data/guides/output/images/i18n/demo_untranslated.png +0 -0
  91. data/guides/output/images/icons/README +5 -0
  92. data/guides/output/images/icons/callouts/1.png +0 -0
  93. data/guides/output/images/icons/callouts/10.png +0 -0
  94. data/guides/output/images/icons/callouts/11.png +0 -0
  95. data/guides/output/images/icons/callouts/12.png +0 -0
  96. data/guides/output/images/icons/callouts/13.png +0 -0
  97. data/guides/output/images/icons/callouts/14.png +0 -0
  98. data/guides/output/images/icons/callouts/15.png +0 -0
  99. data/guides/output/images/icons/callouts/2.png +0 -0
  100. data/guides/output/images/icons/callouts/3.png +0 -0
  101. data/guides/output/images/icons/callouts/4.png +0 -0
  102. data/guides/output/images/icons/callouts/5.png +0 -0
  103. data/guides/output/images/icons/callouts/6.png +0 -0
  104. data/guides/output/images/icons/callouts/7.png +0 -0
  105. data/guides/output/images/icons/callouts/8.png +0 -0
  106. data/guides/output/images/icons/callouts/9.png +0 -0
  107. data/guides/output/images/icons/caution.png +0 -0
  108. data/guides/output/images/icons/example.png +0 -0
  109. data/guides/output/images/icons/home.png +0 -0
  110. data/guides/output/images/icons/important.png +0 -0
  111. data/guides/output/images/icons/next.png +0 -0
  112. data/guides/output/images/icons/note.png +0 -0
  113. data/guides/output/images/icons/prev.png +0 -0
  114. data/guides/output/images/icons/tip.png +0 -0
  115. data/guides/output/images/icons/up.png +0 -0
  116. data/guides/output/images/icons/warning.png +0 -0
  117. data/guides/output/images/nav_arrow.gif +0 -0
  118. data/guides/output/images/oscardelben.jpg +0 -0
  119. data/guides/output/images/polymorphic.png +0 -0
  120. data/guides/output/images/radar.png +0 -0
  121. data/guides/output/images/rails4_features.png +0 -0
  122. data/guides/output/images/rails_guides_kindle_cover.jpg +0 -0
  123. data/guides/output/images/rails_guides_logo.gif +0 -0
  124. data/guides/output/images/rails_logo_remix.gif +0 -0
  125. data/guides/output/images/session_fixation.png +0 -0
  126. data/guides/output/images/tab_grey.gif +0 -0
  127. data/guides/output/images/tab_info.gif +0 -0
  128. data/guides/output/images/tab_note.gif +0 -0
  129. data/guides/output/images/tab_red.gif +0 -0
  130. data/guides/output/images/tab_yellow.gif +0 -0
  131. data/guides/output/images/tab_yellow.png +0 -0
  132. data/guides/output/images/vijaydev.jpg +0 -0
  133. data/guides/output/index.html +354 -0
  134. data/guides/output/initialization.html +876 -0
  135. data/guides/output/javascripts/guides.js +59 -0
  136. data/guides/output/javascripts/jquery.min.js +4 -0
  137. data/guides/output/javascripts/responsive-tables.js +43 -0
  138. data/guides/output/javascripts/syntaxhighlighter/shBrushAS3.js +59 -0
  139. data/guides/output/javascripts/syntaxhighlighter/shBrushAppleScript.js +75 -0
  140. data/guides/output/javascripts/syntaxhighlighter/shBrushBash.js +59 -0
  141. data/guides/output/javascripts/syntaxhighlighter/shBrushCSharp.js +65 -0
  142. data/guides/output/javascripts/syntaxhighlighter/shBrushColdFusion.js +100 -0
  143. data/guides/output/javascripts/syntaxhighlighter/shBrushCpp.js +97 -0
  144. data/guides/output/javascripts/syntaxhighlighter/shBrushCss.js +91 -0
  145. data/guides/output/javascripts/syntaxhighlighter/shBrushDelphi.js +55 -0
  146. data/guides/output/javascripts/syntaxhighlighter/shBrushDiff.js +41 -0
  147. data/guides/output/javascripts/syntaxhighlighter/shBrushErlang.js +52 -0
  148. data/guides/output/javascripts/syntaxhighlighter/shBrushGroovy.js +67 -0
  149. data/guides/output/javascripts/syntaxhighlighter/shBrushJScript.js +52 -0
  150. data/guides/output/javascripts/syntaxhighlighter/shBrushJava.js +57 -0
  151. data/guides/output/javascripts/syntaxhighlighter/shBrushJavaFX.js +58 -0
  152. data/guides/output/javascripts/syntaxhighlighter/shBrushPerl.js +72 -0
  153. data/guides/output/javascripts/syntaxhighlighter/shBrushPhp.js +88 -0
  154. data/guides/output/javascripts/syntaxhighlighter/shBrushPlain.js +33 -0
  155. data/guides/output/javascripts/syntaxhighlighter/shBrushPowerShell.js +74 -0
  156. data/guides/output/javascripts/syntaxhighlighter/shBrushPython.js +64 -0
  157. data/guides/output/javascripts/syntaxhighlighter/shBrushRuby.js +55 -0
  158. data/guides/output/javascripts/syntaxhighlighter/shBrushSass.js +94 -0
  159. data/guides/output/javascripts/syntaxhighlighter/shBrushScala.js +51 -0
  160. data/guides/output/javascripts/syntaxhighlighter/shBrushSql.js +66 -0
  161. data/guides/output/javascripts/syntaxhighlighter/shBrushVb.js +56 -0
  162. data/guides/output/javascripts/syntaxhighlighter/shBrushXml.js +69 -0
  163. data/guides/output/javascripts/syntaxhighlighter/shCore.js +17 -0
  164. data/guides/output/layout.html +448 -0
  165. data/guides/output/layouts_and_rendering.html +1541 -0
  166. data/guides/output/maintenance_policy.html +257 -0
  167. data/guides/output/migrations.html +1360 -0
  168. data/guides/output/nested_model_forms.html +412 -0
  169. data/guides/output/plugins.html +644 -0
  170. data/guides/output/rails_application_templates.html +450 -0
  171. data/guides/output/rails_on_rack.html +547 -0
  172. data/guides/output/routing.html +1631 -0
  173. data/guides/output/ruby_on_rails_guides_guidelines.html +329 -0
  174. data/guides/output/security.html +935 -0
  175. data/guides/output/stylesheets/fixes.css +16 -0
  176. data/guides/output/stylesheets/kindle.css +11 -0
  177. data/guides/output/stylesheets/main.css +713 -0
  178. data/guides/output/stylesheets/print.css +52 -0
  179. data/guides/output/stylesheets/reset.css +43 -0
  180. data/guides/output/stylesheets/responsive-tables.css +50 -0
  181. data/guides/output/stylesheets/style.css +13 -0
  182. data/guides/output/stylesheets/syntaxhighlighter/shCore.css +226 -0
  183. data/guides/output/stylesheets/syntaxhighlighter/shCoreDefault.css +328 -0
  184. data/guides/output/stylesheets/syntaxhighlighter/shCoreDjango.css +331 -0
  185. data/guides/output/stylesheets/syntaxhighlighter/shCoreEclipse.css +339 -0
  186. data/guides/output/stylesheets/syntaxhighlighter/shCoreEmacs.css +324 -0
  187. data/guides/output/stylesheets/syntaxhighlighter/shCoreFadeToGrey.css +328 -0
  188. data/guides/output/stylesheets/syntaxhighlighter/shCoreMDUltra.css +324 -0
  189. data/guides/output/stylesheets/syntaxhighlighter/shCoreMidnight.css +324 -0
  190. data/guides/output/stylesheets/syntaxhighlighter/shCoreRDark.css +324 -0
  191. data/guides/output/stylesheets/syntaxhighlighter/shThemeDefault.css +117 -0
  192. data/guides/output/stylesheets/syntaxhighlighter/shThemeDjango.css +120 -0
  193. data/guides/output/stylesheets/syntaxhighlighter/shThemeEclipse.css +128 -0
  194. data/guides/output/stylesheets/syntaxhighlighter/shThemeEmacs.css +113 -0
  195. data/guides/output/stylesheets/syntaxhighlighter/shThemeFadeToGrey.css +117 -0
  196. data/guides/output/stylesheets/syntaxhighlighter/shThemeMDUltra.css +113 -0
  197. data/guides/output/stylesheets/syntaxhighlighter/shThemeMidnight.css +113 -0
  198. data/guides/output/stylesheets/syntaxhighlighter/shThemeRDark.css +113 -0
  199. data/guides/output/stylesheets/syntaxhighlighter/shThemeRailsGuides.css +116 -0
  200. data/guides/output/testing.html +1350 -0
  201. data/guides/output/upgrading_ruby_on_rails.html +1135 -0
  202. data/guides/output/working_with_javascript_in_rails.html +587 -0
  203. data/guides/source/4_0_release_notes.md +2 -2
  204. data/guides/source/4_2_release_notes.md +9 -2
  205. data/guides/source/action_controller_overview.md +3 -1
  206. data/guides/source/action_mailer_basics.md +1 -2
  207. data/guides/source/active_job_basics.md +25 -2
  208. data/guides/source/active_model_basics.md +350 -19
  209. data/guides/source/active_record_basics.md +2 -2
  210. data/guides/source/active_record_migrations.md +1 -1
  211. data/guides/source/active_record_validations.md +12 -4
  212. data/guides/source/active_support_core_extensions.md +7 -9
  213. data/guides/source/active_support_instrumentation.md +2 -0
  214. data/guides/source/association_basics.md +7 -7
  215. data/guides/source/configuring.md +24 -0
  216. data/guides/source/contributing_to_ruby_on_rails.md +1 -1
  217. data/guides/source/credits.html.erb +1 -1
  218. data/guides/source/documents.yaml +5 -0
  219. data/guides/source/engines.md +2 -2
  220. data/guides/source/form_helpers.md +6 -0
  221. data/guides/source/i18n.md +6 -9
  222. data/guides/source/layouts_and_rendering.md +1 -1
  223. data/guides/source/plugins.md +2 -2
  224. data/guides/source/rails_on_rack.md +4 -0
  225. data/guides/source/testing.md +1 -0
  226. data/guides/source/upgrading_ruby_on_rails.md +5 -5
  227. metadata +227 -27
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 23db52878c0811a5f752e71b8e8632bad5feed99
4
- data.tar.gz: 88d78cccafff95b2219f940052f61b950be8d310
3
+ metadata.gz: c117fac53cace27091e45f1d459b6a899e4ee6d1
4
+ data.tar.gz: a5ce4f29d215423eccbfca3163091dc207a21813
5
5
  SHA512:
6
- metadata.gz: 78ca2f46369e91f0d3c0406e81a5dd39581a1b67afb40e09a23b67eaa8900ddd593f6d55b9b33df0cbed99aa79f40a08244009680c537cc1ca5a4a66d6593b90
7
- data.tar.gz: fa52fcddd7b92d14284d2f185d5c4ce54784e6a3d7accdddf6430a8e6829471d6d801e523e9b100f9e8354e8eb880e4209085c95797845ada36902975a5f1761
6
+ metadata.gz: 44498ffbd87c463e7320ee0618afc965676db7bfd5b555fa9b1b8bb49f2aa909e8a3675db930831b9e0b8bd58c4620cc7adfc74d2979e21107fc4e32aa26976f
7
+ data.tar.gz: c876be357f19a6d995e930fff644f342bfda55d30954fd1d5bc8bb00e8aef26741ef303e709699f88e39589195f72762da435477aa83814530dd841eb16a9403
data/README.md CHANGED
@@ -13,10 +13,10 @@ Person, Post, etc.) and encapsulates the business logic that is specific to
13
13
  your application. In Rails, database-backed model classes are derived from
14
14
  `ActiveRecord::Base`. Active Record allows you to present the data from
15
15
  database rows as objects and embellish these data objects with business logic
16
- methods. Although most Rails models are backed by a database, models can also
17
- be ordinary Ruby classes, or Ruby classes that implement a set of interfaces
18
- as provided by the Active Model module. You can read more about Active Record
19
- in its [README](activerecord/README.rdoc).
16
+ methods. You can read more about Active Record in its [README](activerecord/README.rdoc).
17
+ Although most Rails models are backed by a database, models can also be ordinary
18
+ Ruby classes, or Ruby classes that implement a set of interfaces as provided by
19
+ the Active Model module. You can read more about Active Model in its [README](activemodel/README.rdoc).
20
20
 
21
21
  The _Controller layer_ is responsible for handling incoming HTTP requests and
22
22
  providing a suitable response. Usually this means returning HTML, but Rails controllers
@@ -36,9 +36,11 @@ You can read more about Action View in its [README](actionview/README.rdoc).
36
36
 
37
37
  Active Record, Action Pack, and Action View can each be used independently outside Rails.
38
38
  In addition to them, Rails also comes with Action Mailer ([README](actionmailer/README.rdoc)), a library
39
- to generate and send emails; and Active Support ([README](activesupport/README.rdoc)), a collection of
40
- utility classes and standard library extensions that are useful for Rails, and may also be used
41
- independently outside Rails.
39
+ to generate and send emails; Active Job ([README](activejob/README.md)), a
40
+ framework for declaring jobs and making them run on a variety of queueing
41
+ backends; and Active Support ([README](activesupport/README.rdoc)), a collection
42
+ of utility classes and standard library extensions that are useful for Rails,
43
+ and may also be used independently outside Rails.
42
44
 
43
45
  ## Getting Started
44
46
 
@@ -0,0 +1,724 @@
1
+ <!DOCTYPE html>
2
+
3
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4
+ <head>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
6
+ <meta name="viewport" content="width=device-width, initial-scale=1"/>
7
+
8
+ <title>Ruby on Rails 2.2 Release Notes — Ruby on Rails Guides</title>
9
+ <link rel="stylesheet" type="text/css" href="stylesheets/style.css" />
10
+ <link rel="stylesheet" type="text/css" href="stylesheets/print.css" media="print" />
11
+
12
+ <link rel="stylesheet" type="text/css" href="stylesheets/syntaxhighlighter/shCore.css" />
13
+ <link rel="stylesheet" type="text/css" href="stylesheets/syntaxhighlighter/shThemeRailsGuides.css" />
14
+
15
+ <link rel="stylesheet" type="text/css" href="stylesheets/fixes.css" />
16
+
17
+ <link href="images/favicon.ico" rel="shortcut icon" type="image/x-icon" />
18
+ </head>
19
+ <body class="guide">
20
+ <div id="topNav">
21
+ <div class="wrapper">
22
+ <strong class="more-info-label">More at <a href="http://rubyonrails.org/">rubyonrails.org:</a> </strong>
23
+ <span class="red-button more-info-button">
24
+ More Ruby on Rails
25
+ </span>
26
+ <ul class="more-info-links s-hidden">
27
+ <li class="more-info"><a href="http://rubyonrails.org/">Overview</a></li>
28
+ <li class="more-info"><a href="http://rubyonrails.org/download">Download</a></li>
29
+ <li class="more-info"><a href="http://rubyonrails.org/deploy">Deploy</a></li>
30
+ <li class="more-info"><a href="https://github.com/rails/rails">Code</a></li>
31
+ <li class="more-info"><a href="http://rubyonrails.org/screencasts">Screencasts</a></li>
32
+ <li class="more-info"><a href="http://rubyonrails.org/documentation">Documentation</a></li>
33
+ <li class="more-info"><a href="http://rubyonrails.org/community">Community</a></li>
34
+ <li class="more-info"><a href="http://weblog.rubyonrails.org/">Blog</a></li>
35
+ </ul>
36
+ </div>
37
+ </div>
38
+ <div id="header">
39
+ <div class="wrapper clearfix">
40
+ <h1><a href="index.html" title="Return to home page">Guides.rubyonrails.org</a></h1>
41
+ <ul class="nav">
42
+ <li><a class="nav-item" href="index.html">Home</a></li>
43
+ <li class="guides-index guides-index-large">
44
+ <a href="index.html" id="guidesMenu" class="guides-index-item nav-item">Guides Index</a>
45
+ <div id="guides" class="clearfix" style="display: none;">
46
+ <hr />
47
+ <dl class="L">
48
+ <dt>Start Here</dt>
49
+ <dd><a href="getting_started.html">Getting Started with Rails</a></dd>
50
+ <dt>Models</dt>
51
+ <dd><a href="active_record_basics.html">Active Record Basics</a></dd>
52
+ <dd><a href="active_record_migrations.html">Active Record Migrations</a></dd>
53
+ <dd><a href="active_record_validations.html">Active Record Validations</a></dd>
54
+ <dd><a href="active_record_callbacks.html">Active Record Callbacks</a></dd>
55
+ <dd><a href="association_basics.html">Active Record Associations</a></dd>
56
+ <dd><a href="active_record_querying.html">Active Record Query Interface</a></dd>
57
+ <dt>Views</dt>
58
+ <dd><a href="layouts_and_rendering.html">Layouts and Rendering in Rails</a></dd>
59
+ <dd><a href="form_helpers.html">Action View Form Helpers</a></dd>
60
+ <dt>Controllers</dt>
61
+ <dd><a href="action_controller_overview.html">Action Controller Overview</a></dd>
62
+ <dd><a href="routing.html">Rails Routing from the Outside In</a></dd>
63
+ </dl>
64
+ <dl class="R">
65
+ <dt>Digging Deeper</dt>
66
+ <dd><a href="active_support_core_extensions.html">Active Support Core Extensions</a></dd>
67
+ <dd><a href="i18n.html">Rails Internationalization API</a></dd>
68
+ <dd><a href="action_mailer_basics.html">Action Mailer Basics</a></dd>
69
+ <dd><a href="active_job_basics.html">Active Job Basics</a></dd>
70
+ <dd><a href="security.html">Securing Rails Applications</a></dd>
71
+ <dd><a href="debugging_rails_applications.html">Debugging Rails Applications</a></dd>
72
+ <dd><a href="configuring.html">Configuring Rails Applications</a></dd>
73
+ <dd><a href="command_line.html">Rails Command Line Tools and Rake Tasks</a></dd>
74
+ <dd><a href="asset_pipeline.html">Asset Pipeline</a></dd>
75
+ <dd><a href="working_with_javascript_in_rails.html">Working with JavaScript in Rails</a></dd>
76
+ <dt>Extending Rails</dt>
77
+ <dd><a href="rails_on_rack.html">Rails on Rack</a></dd>
78
+ <dd><a href="generators.html">Creating and Customizing Rails Generators</a></dd>
79
+ <dt>Contributing to Ruby on Rails</dt>
80
+ <dd><a href="contributing_to_ruby_on_rails.html">Contributing to Ruby on Rails</a></dd>
81
+ <dd><a href="api_documentation_guidelines.html">API Documentation Guidelines</a></dd>
82
+ <dd><a href="ruby_on_rails_guides_guidelines.html">Ruby on Rails Guides Guidelines</a></dd>
83
+ <dt>Maintenance Policy</dt>
84
+ <dd><a href="maintenance_policy.html">Maintenance Policy</a></dd>
85
+ <dt>Release Notes</dt>
86
+ <dd><a href="upgrading_ruby_on_rails.html">Upgrading Ruby on Rails</a></dd>
87
+ <dd><a href="4_1_release_notes.html">Ruby on Rails 4.1 Release Notes</a></dd>
88
+ <dd><a href="4_0_release_notes.html">Ruby on Rails 4.0 Release Notes</a></dd>
89
+ <dd><a href="3_2_release_notes.html">Ruby on Rails 3.2 Release Notes</a></dd>
90
+ <dd><a href="3_1_release_notes.html">Ruby on Rails 3.1 Release Notes</a></dd>
91
+ <dd><a href="3_0_release_notes.html">Ruby on Rails 3.0 Release Notes</a></dd>
92
+ <dd><a href="2_3_release_notes.html">Ruby on Rails 2.3 Release Notes</a></dd>
93
+ <dd><a href="2_2_release_notes.html">Ruby on Rails 2.2 Release Notes</a></dd>
94
+ </dl>
95
+ </div>
96
+ </li>
97
+ <li><a class="nav-item" href="contributing_to_ruby_on_rails.html">Contribute</a></li>
98
+ <li><a class="nav-item" href="credits.html">Credits</a></li>
99
+ <li class="guides-index guides-index-small">
100
+ <select class="guides-index-item nav-item">
101
+ <option value="index.html">Guides Index</option>
102
+ <optgroup label="Start Here">
103
+ <option value="getting_started.html">Getting Started with Rails</option>
104
+ </optgroup>
105
+ <optgroup label="Models">
106
+ <option value="active_record_basics.html">Active Record Basics</option>
107
+ <option value="active_record_migrations.html">Active Record Migrations</option>
108
+ <option value="active_record_validations.html">Active Record Validations</option>
109
+ <option value="active_record_callbacks.html">Active Record Callbacks</option>
110
+ <option value="association_basics.html">Active Record Associations</option>
111
+ <option value="active_record_querying.html">Active Record Query Interface</option>
112
+ </optgroup>
113
+ <optgroup label="Views">
114
+ <option value="layouts_and_rendering.html">Layouts and Rendering in Rails</option>
115
+ <option value="form_helpers.html">Action View Form Helpers</option>
116
+ </optgroup>
117
+ <optgroup label="Controllers">
118
+ <option value="action_controller_overview.html">Action Controller Overview</option>
119
+ <option value="routing.html">Rails Routing from the Outside In</option>
120
+ </optgroup>
121
+ <optgroup label="Digging Deeper">
122
+ <option value="active_support_core_extensions.html">Active Support Core Extensions</option>
123
+ <option value="i18n.html">Rails Internationalization API</option>
124
+ <option value="action_mailer_basics.html">Action Mailer Basics</option>
125
+ <option value="active_job_basics.html">Active Job Basics</option>
126
+ <option value="security.html">Securing Rails Applications</option>
127
+ <option value="debugging_rails_applications.html">Debugging Rails Applications</option>
128
+ <option value="configuring.html">Configuring Rails Applications</option>
129
+ <option value="command_line.html">Rails Command Line Tools and Rake Tasks</option>
130
+ <option value="asset_pipeline.html">Asset Pipeline</option>
131
+ <option value="working_with_javascript_in_rails.html">Working with JavaScript in Rails</option>
132
+ </optgroup>
133
+ <optgroup label="Extending Rails">
134
+ <option value="rails_on_rack.html">Rails on Rack</option>
135
+ <option value="generators.html">Creating and Customizing Rails Generators</option>
136
+ </optgroup>
137
+ <optgroup label="Contributing to Ruby on Rails">
138
+ <option value="contributing_to_ruby_on_rails.html">Contributing to Ruby on Rails</option>
139
+ <option value="api_documentation_guidelines.html">API Documentation Guidelines</option>
140
+ <option value="ruby_on_rails_guides_guidelines.html">Ruby on Rails Guides Guidelines</option>
141
+ </optgroup>
142
+ <optgroup label="Maintenance Policy">
143
+ <option value="maintenance_policy.html">Maintenance Policy</option>
144
+ </optgroup>
145
+ <optgroup label="Release Notes">
146
+ <option value="upgrading_ruby_on_rails.html">Upgrading Ruby on Rails</option>
147
+ <option value="4_1_release_notes.html">Ruby on Rails 4.1 Release Notes</option>
148
+ <option value="4_0_release_notes.html">Ruby on Rails 4.0 Release Notes</option>
149
+ <option value="3_2_release_notes.html">Ruby on Rails 3.2 Release Notes</option>
150
+ <option value="3_1_release_notes.html">Ruby on Rails 3.1 Release Notes</option>
151
+ <option value="3_0_release_notes.html">Ruby on Rails 3.0 Release Notes</option>
152
+ <option value="2_3_release_notes.html">Ruby on Rails 2.3 Release Notes</option>
153
+ <option value="2_2_release_notes.html">Ruby on Rails 2.2 Release Notes</option>
154
+ </optgroup>
155
+ </select>
156
+ </li>
157
+ </ul>
158
+ </div>
159
+ </div>
160
+ <hr class="hide" />
161
+
162
+ <div id="feature">
163
+ <div class="wrapper">
164
+ <h2>Ruby on Rails 2.2 Release Notes</h2><p>Rails 2.2 delivers a number of new and improved features. This list covers the major upgrades, but doesn&#39;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><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>
165
+
166
+ <div id="subCol">
167
+ <h3 class="chapter"><img src="images/chapters_icon.gif" alt="" />Chapters</h3>
168
+ <ol class="chapters">
169
+ <li>
170
+ <a href="#infrastructure">Infrastructure</a>
171
+
172
+ <ul>
173
+ <li><a href="#internationalization">Internationalization</a></li>
174
+ <li><a href="#compatibility-with-ruby-1.9-and-jruby">Compatibility with Ruby 1.9 and JRuby</a></li>
175
+ </ul>
176
+ </li>
177
+ <li><a href="#documentation">Documentation</a></li>
178
+ <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>
179
+ <li><a href="#thread-safety">Thread Safety</a></li>
180
+ <li>
181
+ <a href="#active-record">Active Record</a>
182
+
183
+ <ul>
184
+ <li><a href="#transactional-migrations">Transactional Migrations</a></li>
185
+ <li><a href="#connection-pooling">Connection Pooling</a></li>
186
+ <li><a href="#hashes-for-join-table-conditions">Hashes for Join Table Conditions</a></li>
187
+ <li><a href="#new-dynamic-finders">New Dynamic Finders</a></li>
188
+ <li><a href="#associations-respect-private/protected-scope">Associations Respect Private/Protected Scope</a></li>
189
+ <li><a href="#other-active-record-changes">Other Active Record Changes</a></li>
190
+ </ul>
191
+ </li>
192
+ <li>
193
+ <a href="#action-controller">Action Controller</a>
194
+
195
+ <ul>
196
+ <li><a href="#shallow-route-nesting">Shallow Route Nesting</a></li>
197
+ <li><a href="#method-arrays-for-member-or-collection-routes">Method Arrays for Member or Collection Routes</a></li>
198
+ <li><a href="#resources-with-specific-actions">Resources With Specific Actions</a></li>
199
+ <li><a href="#other-action-controller-changes">Other Action Controller Changes</a></li>
200
+ </ul>
201
+ </li>
202
+ <li><a href="#action-view">Action View</a></li>
203
+ <li><a href="#action-mailer">Action Mailer</a></li>
204
+ <li>
205
+ <a href="#active-support">Active Support</a>
206
+
207
+ <ul>
208
+ <li><a href="#memoization">Memoization</a></li>
209
+ <li><a href="#each_with_object">each_with_object</a></li>
210
+ <li><a href="#delegates-with-prefixes">Delegates With Prefixes</a></li>
211
+ <li><a href="#other-active-support-changes">Other Active Support Changes</a></li>
212
+ </ul>
213
+ </li>
214
+ <li>
215
+ <a href="#railties">Railties</a>
216
+
217
+ <ul>
218
+ <li><a href="#config.gems">config.gems</a></li>
219
+ <li><a href="#other-railties-changes">Other Railties Changes</a></li>
220
+ </ul>
221
+ </li>
222
+ <li><a href="#deprecated">Deprecated</a></li>
223
+ <li><a href="#credits">Credits</a></li>
224
+ </ol>
225
+
226
+ </div>
227
+
228
+ </div>
229
+ </div>
230
+
231
+ <div id="container">
232
+ <div class="wrapper">
233
+ <div id="mainCol">
234
+ <h3 id="infrastructure">1 Infrastructure</h3><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><h4 id="internationalization">1.1 Internationalization</h4><p>Rails 2.2 supplies an easy system for internationalization (or i18n, for those of you tired of typing).</p>
235
+ <ul>
236
+ <li>Lead Contributors: Rails i18 Team</li>
237
+ <li>More information :
238
+
239
+ <ul>
240
+ <li><a href="http://rails-i18n.org">Official Rails i18 website</a></li>
241
+ <li><a href="http://www.artweb-design.de/2008/7/18/finally-ruby-on-rails-gets-internationalized">Finally. Ruby on Rails gets internationalized</a></li>
242
+ <li><a href="http://github.com/clemens/i18n_demo_app">Localizing Rails : Demo application</a></li>
243
+ </ul>
244
+ </li>
245
+ </ul>
246
+ <h4 id="compatibility-with-ruby-1.9-and-jruby">1.2 Compatibility with Ruby 1.9 and JRuby</h4><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><h3 id="documentation">2 Documentation</h3><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>
247
+ <ul>
248
+ <li><a href="getting_started.html">Getting Started with Rails</a></li>
249
+ <li><a href="migrations.html">Rails Database Migrations</a></li>
250
+ <li><a href="association_basics.html">Active Record Associations</a></li>
251
+ <li><a href="active_record_querying.html">Active Record Query Interface</a></li>
252
+ <li><a href="layouts_and_rendering.html">Layouts and Rendering in Rails</a></li>
253
+ <li><a href="form_helpers.html">Action View Form Helpers</a></li>
254
+ <li><a href="routing.html">Rails Routing from the Outside In</a></li>
255
+ <li><a href="action_controller_overview.html">Action Controller Overview</a></li>
256
+ <li><a href="caching_with_rails.html">Rails Caching</a></li>
257
+ <li><a href="testing.html">A Guide to Testing Rails Applications</a></li>
258
+ <li><a href="security.html">Securing Rails Applications</a></li>
259
+ <li><a href="debugging_rails_applications.html">Debugging Rails Applications</a></li>
260
+ <li><a href="performance_testing.html">Performance Testing Rails Applications</a></li>
261
+ <li><a href="plugins.html">The Basics of Creating Rails Plugins</a></li>
262
+ </ul>
263
+ <p>All told, the Guides provide tens of thousands of words of guidance for beginning and intermediate Rails developers.</p><p>If you want to generate these guides locally, inside your application:</p><div class="code_container">
264
+ <pre class="brush: plain; gutter: false; toolbar: false">
265
+ rake doc:guides
266
+
267
+ </pre>
268
+ </div>
269
+ <p>This will put the guides inside <code>Rails.root/doc/guides</code> and you may start surfing straight away by opening <code>Rails.root/doc/guides/index.html</code> in your favourite browser.</p>
270
+ <ul>
271
+ <li>Lead Contributors: <a href="credits.html">Rails Documentation Team</a>
272
+ </li>
273
+ <li>Major contributions from <a href="http://izumi.plan99.net/blog/.">Xavier Noria":http://advogato.org/person/fxn/diary.html and "Hongli Lai</a>
274
+ </li>
275
+ <li>More information:
276
+
277
+ <ul>
278
+ <li><a href="http://hackfest.rubyonrails.org/guide">Rails Guides hackfest</a></li>
279
+ <li><a href="http://weblog.rubyonrails.org/2008/5/2/help-improve-rails-documentation-on-git-branch">Help improve Rails documentation on Git branch</a></li>
280
+ </ul>
281
+ </li>
282
+ </ul>
283
+ <h3 id="better-integration-with-http-:-out-of-the-box-etag-support">3 Better integration with HTTP : Out of the box ETag support</h3><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't been modified lately. This allows you to check whether a response needs to be sent at all.</p><div class="code_container">
284
+ <pre class="brush: ruby; gutter: false; toolbar: false">
285
+ class ArticlesController &lt; ApplicationController
286
+ def show_with_respond_to_block
287
+ @article = Article.find(params[:id])
288
+
289
+ # If the request sends headers that differs from the options provided to stale?, then
290
+ # the request is indeed stale and the respond_to block is triggered (and the options
291
+ # to the stale? call is set on the response).
292
+ #
293
+ # If the request headers match, then the request is fresh and the respond_to block is
294
+ # not triggered. Instead the default render will occur, which will check the last-modified
295
+ # and etag headers and conclude that it only needs to send a "304 Not Modified" instead
296
+ # of rendering the template.
297
+ if stale?(:last_modified =&gt; @article.published_at.utc, :etag =&gt; @article)
298
+ respond_to do |wants|
299
+ # normal response processing
300
+ end
301
+ end
302
+ end
303
+
304
+ def show_with_implied_render
305
+ @article = Article.find(params[:id])
306
+
307
+ # Sets the response headers and checks them against the request, if the request is stale
308
+ # (i.e. no match of either etag or last-modified), then the default render of the template happens.
309
+ # If the request is fresh, then the default render will return a "304 Not Modified"
310
+ # instead of rendering the template.
311
+ fresh_when(:last_modified =&gt; @article.published_at.utc, :etag =&gt; @article)
312
+ end
313
+ end
314
+
315
+ </pre>
316
+ </div>
317
+ <h3 id="thread-safety">4 Thread Safety</h3><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><p>To enable multithreaded dispatching in production mode of your application, add the following line in your <code>config/environments/production.rb</code>:</p><div class="code_container">
318
+ <pre class="brush: ruby; gutter: false; toolbar: false">
319
+ config.threadsafe!
320
+
321
+ </pre>
322
+ </div>
323
+
324
+ <ul>
325
+ <li>More information :
326
+
327
+ <ul>
328
+ <li><a href="http://m.onkey.org/2008/10/23/thread-safety-for-your-rails">Thread safety for your Rails</a></li>
329
+ <li><a href="http://weblog.rubyonrails.org/2008/8/16/josh-peek-officially-joins-the-rails-core">Thread safety project announcement</a></li>
330
+ <li><a href="http://blog.headius.com/2008/08/qa-what-thread-safe-rails-means.html">Q/A: What Thread-safe Rails Means</a></li>
331
+ </ul>
332
+ </li>
333
+ </ul>
334
+ <h3 id="active-record">5 Active Record</h3><p>There are two big additions to talk about here: transactional migrations and pooled database transactions. There's also a new (and cleaner) syntax for join table conditions, as well as a number of smaller improvements.</p><h4 id="transactional-migrations">5.1 Transactional Migrations</h4><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't applied. Also, the migration version was stored as having been executed, which means that it couldn't be simply rerun by <code>rake db:migrate:redo</code> 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>
335
+ <ul>
336
+ <li>Lead Contributor: <a href="http://adam.heroku.com/">Adam Wiggins</a>
337
+ </li>
338
+ <li>More information:
339
+
340
+ <ul>
341
+ <li><a href="http://adam.heroku.com/past/2008/9/3/ddl_transactions/">DDL Transactions</a></li>
342
+ <li><a href="http://db2onrails.com/2008/11/08/a-major-milestone-for-db2-on-rails/">A major milestone for DB2 on Rails</a></li>
343
+ </ul>
344
+ </li>
345
+ </ul>
346
+ <h4 id="connection-pooling">5.2 Connection Pooling</h4><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 <code>pool</code> key to your <code>database.yml</code> to adjust this). This helps remove bottlenecks in applications that support many concurrent users. There's also a <code>wait_timeout</code> that defaults to 5 seconds before giving up. <code>ActiveRecord::Base.connection_pool</code> gives you direct access to the pool if you need it.</p><div class="code_container">
347
+ <pre class="brush: plain; gutter: false; toolbar: false">
348
+ development:
349
+ adapter: mysql
350
+ username: root
351
+ database: sample_development
352
+ pool: 10
353
+ wait_timeout: 10
354
+
355
+ </pre>
356
+ </div>
357
+
358
+ <ul>
359
+ <li>Lead Contributor: <a href="http://blog.nicksieger.com/">Nick Sieger</a>
360
+ </li>
361
+ <li>More information:
362
+
363
+ <ul>
364
+ <li><a href="http://ryandaigle.com/articles/2008/9/7/what-s-new-in-edge-rails-connection-pools">What's New in Edge Rails: Connection Pools</a></li>
365
+ </ul>
366
+ </li>
367
+ </ul>
368
+ <h4 id="hashes-for-join-table-conditions">5.3 Hashes for Join Table Conditions</h4><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 class="code_container">
369
+ <pre class="brush: ruby; gutter: false; toolbar: false">
370
+ class Photo &lt; ActiveRecord::Base
371
+ belongs_to :product
372
+ end
373
+
374
+ class Product &lt; ActiveRecord::Base
375
+ has_many :photos
376
+ end
377
+
378
+ # Get all products with copyright-free photos:
379
+ Product.all(:joins =&gt; :photos, :conditions =&gt; { :photos =&gt; { :copyright =&gt; false }})
380
+
381
+ </pre>
382
+ </div>
383
+
384
+ <ul>
385
+ <li>More information:
386
+
387
+ <ul>
388
+ <li><a href="http://ryandaigle.com/articles/2008/7/7/what-s-new-in-edge-rails-easy-join-table-conditions">What's New in Edge Rails: Easy Join Table Conditions</a></li>
389
+ </ul>
390
+ </li>
391
+ </ul>
392
+ <h4 id="new-dynamic-finders">5.4 New Dynamic Finders</h4><p>Two new sets of methods have been added to Active Record's dynamic finders family.</p><h5 id="find_last_by_attribute">5.4.1 <code>find_last_by_attribute</code>
393
+ </h5><p>The <code>find_last_by_attribute</code> method is equivalent to <code>Model.last(:conditions =&gt; {:attribute =&gt; value})</code></p><div class="code_container">
394
+ <pre class="brush: ruby; gutter: false; toolbar: false">
395
+ # Get the last user who signed up from London
396
+ User.find_last_by_city('London')
397
+
398
+ </pre>
399
+ </div>
400
+
401
+ <ul>
402
+ <li>Lead Contributor: <a href="http://www.workingwithrails.com/person/9147-emilio-tagua">Emilio Tagua</a>
403
+ </li>
404
+ </ul>
405
+ <h5 id="find_by_attribute-bang">5.4.2 <code>find_by_attribute!</code>
406
+ </h5><p>The new bang! version of <code>find_by_attribute!</code> is equivalent to <code>Model.first(:conditions =&gt; {:attribute =&gt; value}) || raise ActiveRecord::RecordNotFound</code> Instead of returning <code>nil</code> if it can't find a matching record, this method will raise an exception if it cannot find a match.</p><div class="code_container">
407
+ <pre class="brush: ruby; gutter: false; toolbar: false">
408
+ # Raise ActiveRecord::RecordNotFound exception if 'Moby' hasn't signed up yet!
409
+ User.find_by_name!('Moby')
410
+
411
+ </pre>
412
+ </div>
413
+
414
+ <ul>
415
+ <li>Lead Contributor: <a href="http://blog.hasmanythrough.com">Josh Susser</a>
416
+ </li>
417
+ </ul>
418
+ <h4 id="associations-respect-private/protected-scope">5.5 Associations Respect Private/Protected Scope</h4><p>Active Record association proxies now respect the scope of methods on the proxied object. Previously (given User has_one :account) <code>@user.account.private_method</code> would call the private method on the associated Account object. That fails in Rails 2.2; if you need this functionality, you should use <code>@user.account.send(:private_method)</code> (or make the method public instead of private or protected). Please note that if you're overriding <code>method_missing</code>, you should also override <code>respond_to</code> to match the behavior in order for associations to function normally.</p>
419
+ <ul>
420
+ <li>Lead Contributor: Adam Milligan</li>
421
+ <li>More information:
422
+
423
+ <ul>
424
+ <li><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></li>
425
+ </ul>
426
+ </li>
427
+ </ul>
428
+ <h4 id="other-active-record-changes">5.6 Other Active Record Changes</h4>
429
+ <ul>
430
+ <li>
431
+ <code>rake db:migrate:redo</code> now accepts an optional VERSION to target that specific migration to redo</li>
432
+ <li>Set <code>config.active_record.timestamped_migrations = false</code> to have migrations with numeric prefix instead of UTC timestamp.</li>
433
+ <li>Counter cache columns (for associations declared with <code>:counter_cache =&gt; true</code>) do not need to be initialized to zero any longer.</li>
434
+ <li>
435
+ <code>ActiveRecord::Base.human_name</code> for an internationalization-aware humane translation of model names</li>
436
+ </ul>
437
+ <h3 id="action-controller">6 Action Controller</h3><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><h4 id="shallow-route-nesting">6.1 Shallow Route Nesting</h4><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 class="code_container">
438
+ <pre class="brush: ruby; gutter: false; toolbar: false">
439
+ map.resources :publishers, :shallow =&gt; true do |publisher|
440
+ publisher.resources :magazines do |magazine|
441
+ magazine.resources :photos
442
+ end
443
+ end
444
+
445
+ </pre>
446
+ </div>
447
+ <p>This will enable recognition of (among others) these routes:</p><div class="code_container">
448
+ <pre class="brush: plain; gutter: false; toolbar: false">
449
+ /publishers/1 ==&gt; publisher_path(1)
450
+ /publishers/1/magazines ==&gt; publisher_magazines_path(1)
451
+ /magazines/2 ==&gt; magazine_path(2)
452
+ /magazines/2/photos ==&gt; magazines_photos_path(2)
453
+ /photos/3 ==&gt; photo_path(3)
454
+
455
+ </pre>
456
+ </div>
457
+
458
+ <ul>
459
+ <li>Lead Contributor: <a href="http://www.unwwwired.net/">S. Brent Faulkner</a>
460
+ </li>
461
+ <li>More information:
462
+
463
+ <ul>
464
+ <li><a href="routing.html#nested-resources">Rails Routing from the Outside In</a></li>
465
+ <li><a href="http://ryandaigle.com/articles/2008/9/7/what-s-new-in-edge-rails-shallow-routes">What's New in Edge Rails: Shallow Routes</a></li>
466
+ </ul>
467
+ </li>
468
+ </ul>
469
+ <h4 id="method-arrays-for-member-or-collection-routes">6.2 Method Arrays for Member or Collection Routes</h4><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 class="code_container">
470
+ <pre class="brush: ruby; gutter: false; toolbar: false">
471
+ map.resources :photos, :collection =&gt; { :search =&gt; [:get, :post] }
472
+
473
+ </pre>
474
+ </div>
475
+
476
+ <ul>
477
+ <li>Lead Contributor: <a href="http://brennandunn.com/">Brennan Dunn</a>
478
+ </li>
479
+ </ul>
480
+ <h4 id="resources-with-specific-actions">6.3 Resources With Specific Actions</h4><p>By default, when you use <code>map.resources</code> 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 <code>:only</code> and <code>:except</code> 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 <code>:all</code> or <code>:none</code> options. These options are inherited by nested resources.</p><div class="code_container">
481
+ <pre class="brush: ruby; gutter: false; toolbar: false">
482
+ map.resources :photos, :only =&gt; [:index, :show]
483
+ map.resources :products, :except =&gt; :destroy
484
+
485
+ </pre>
486
+ </div>
487
+
488
+ <ul>
489
+ <li>Lead Contributor: <a href="http://experthuman.com/">Tom Stuart</a>
490
+ </li>
491
+ </ul>
492
+ <h4 id="other-action-controller-changes">6.4 Other Action Controller Changes</h4>
493
+ <ul>
494
+ <li>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.</li>
495
+ <li>The HTTP Accept header is disabled by default now. You should prefer the use of formatted URLs (such as <code>/customers/1.xml</code>) to indicate the format that you want. If you need the Accept headers, you can turn them back on with <code>config.action_controller.use_accept_header = true</code>.</li>
496
+ <li>Benchmarking numbers are now reported in milliseconds rather than tiny fractions of seconds</li>
497
+ <li>Rails now supports HTTP-only cookies (and uses them for sessions), which help mitigate some cross-site scripting risks in newer browsers.</li>
498
+ <li>
499
+ <code>redirect_to</code> now fully supports URI schemes (so, for example, you can redirect to a svn`ssh: URI).</li>
500
+ <li>
501
+ <code>render</code> now supports a <code>:js</code> option to render plain vanilla JavaScript with the right mime type.</li>
502
+ <li>Request forgery protection has been tightened up to apply to HTML-formatted content requests only.</li>
503
+ <li>Polymorphic URLs behave more sensibly if a passed parameter is nil. For example, calling <code>polymorphic_path([@project, @date, @area])</code> with a nil date will give you <code>project_area_path</code>.</li>
504
+ </ul>
505
+ <h3 id="action-view">7 Action View</h3>
506
+ <ul>
507
+ <li>
508
+ <code>javascript_include_tag</code> and <code>stylesheet_link_tag</code> support a new <code>:recursive</code> option to be used along with <code>:all</code>, so that you can load an entire tree of files with a single line of code.</li>
509
+ <li>The included Prototype JavaScript library has been upgraded to version 1.6.0.3.</li>
510
+ <li>
511
+ <code>RJS#page.reload</code> to reload the browser's current location via JavaScript</li>
512
+ <li>The <code>atom_feed</code> helper now takes an <code>:instruct</code> option to let you insert XML processing instructions.</li>
513
+ </ul>
514
+ <h3 id="action-mailer">8 Action Mailer</h3><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 <code>CustomerMailer</code> class expects to use <code>layouts/customer_mailer.html.erb</code>.</p>
515
+ <ul>
516
+ <li>More information:
517
+
518
+ <ul>
519
+ <li><a href="http://ryandaigle.com/articles/2008/9/7/what-s-new-in-edge-rails-mailer-layouts">What's New in Edge Rails: Mailer Layouts</a></li>
520
+ </ul>
521
+ </li>
522
+ </ul>
523
+ <p>Action Mailer now offers built-in support for GMail's SMTP servers, by turning on STARTTLS automatically. This requires Ruby 1.8.7 to be installed.</p><h3 id="active-support">9 Active Support</h3><p>Active Support now offers built-in memoization for Rails applications, the <code>each_with_object</code> method, prefix support on delegates, and various other new utility methods.</p><h4 id="memoization">9.1 Memoization</h4><p>Memoization is a pattern of initializing a method once and then stashing its value away for repeat use. You've probably used this pattern in your own applications:</p><div class="code_container">
524
+ <pre class="brush: ruby; gutter: false; toolbar: false">
525
+ def full_name
526
+ @full_name ||= "#{first_name} #{last_name}"
527
+ end
528
+
529
+ </pre>
530
+ </div>
531
+ <p>Memoization lets you handle this task in a declarative fashion:</p><div class="code_container">
532
+ <pre class="brush: ruby; gutter: false; toolbar: false">
533
+ extend ActiveSupport::Memoizable
534
+
535
+ def full_name
536
+ "#{first_name} #{last_name}"
537
+ end
538
+ memoize :full_name
539
+
540
+ </pre>
541
+ </div>
542
+ <p>Other features of memoization include <code>unmemoize</code>, <code>unmemoize_all</code>, and <code>memoize_all</code> to turn memoization on or off.</p>
543
+ <ul>
544
+ <li>Lead Contributor: <a href="http://joshpeek.com/">Josh Peek</a>
545
+ </li>
546
+ <li>More information:
547
+
548
+ <ul>
549
+ <li><a href="http://ryandaigle.com/articles/2008/7/16/what-s-new-in-edge-rails-memoization">What's New in Edge Rails: Easy Memoization</a></li>
550
+ <li><a href="http://www.railway.at/articles/2008/09/20/a-guide-to-memoization">Memo-what? A Guide to Memoization</a></li>
551
+ </ul>
552
+ </li>
553
+ </ul>
554
+ <h4 id="each_with_object">9.2 each_with_object</h4><p>The <code>each_with_object</code> method provides an alternative to <code>inject</code>, 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 class="code_container">
555
+ <pre class="brush: ruby; gutter: false; toolbar: false">
556
+ %w(foo bar).each_with_object({}) { |str, hsh| hsh[str] = str.upcase } # =&gt; {'foo' =&gt; 'FOO', 'bar' =&gt; 'BAR'}
557
+
558
+ </pre>
559
+ </div>
560
+ <p>Lead Contributor: <a href="http://therealadam.com/">Adam Keys</a></p><h4 id="delegates-with-prefixes">9.3 Delegates With Prefixes</h4><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 class="code_container">
561
+ <pre class="brush: ruby; gutter: false; toolbar: false">
562
+ class Vendor &lt; ActiveRecord::Base
563
+ has_one :account
564
+ delegate :email, :password, :to =&gt; :account, :prefix =&gt; true
565
+ end
566
+
567
+ </pre>
568
+ </div>
569
+ <p>This will produce delegated methods <code>vendor#account_email</code> and <code>vendor#account_password</code>. You can also specify a custom prefix:</p><div class="code_container">
570
+ <pre class="brush: ruby; gutter: false; toolbar: false">
571
+ class Vendor &lt; ActiveRecord::Base
572
+ has_one :account
573
+ delegate :email, :password, :to =&gt; :account, :prefix =&gt; :owner
574
+ end
575
+
576
+ </pre>
577
+ </div>
578
+ <p>This will produce delegated methods <code>vendor#owner_email</code> and <code>vendor#owner_password</code>.</p><p>Lead Contributor: <a href="http://workingwithrails.com/person/5830-daniel-schierbeck">Daniel Schierbeck</a></p><h4 id="other-active-support-changes">9.4 Other Active Support Changes</h4>
579
+ <ul>
580
+ <li>Extensive updates to <code>ActiveSupport::Multibyte</code>, including Ruby 1.9 compatibility fixes.</li>
581
+ <li>The addition of <code>ActiveSupport::Rescuable</code> allows any class to mix in the <code>rescue_from</code> syntax.</li>
582
+ <li>
583
+ <code>past?</code>, <code>today?</code> and <code>future?</code> for <code>Date</code> and <code>Time</code> classes to facilitate date/time comparisons.</li>
584
+ <li>
585
+ <code>Array#second</code> through <code>Array#fifth</code> as aliases for <code>Array#[1]</code> through <code>Array#[4]</code>
586
+ </li>
587
+ <li>
588
+ <code>Enumerable#many?</code> to encapsulate <code>collection.size &gt; 1</code>
589
+ </li>
590
+ <li>
591
+ <code>Inflector#parameterize</code> produces a URL-ready version of its input, for use in <code>to_param</code>.</li>
592
+ <li>
593
+ <code>Time#advance</code> recognizes fractional days and weeks, so you can do <code>1.7.weeks.ago</code>, <code>1.5.hours.since</code>, and so on.</li>
594
+ <li>The included TzInfo library has been upgraded to version 0.3.12.</li>
595
+ <li>
596
+ <code>ActiveSupport::StringInquirer</code> gives you a pretty way to test for equality in strings: <code>ActiveSupport::StringInquirer.new("abc").abc? =&gt; true</code>
597
+ </li>
598
+ </ul>
599
+ <h3 id="railties">10 Railties</h3><p>In Railties (the core code of Rails itself) the biggest changes are in the <code>config.gems</code> mechanism.</p><h4 id="config.gems">10.1 config.gems</h4><p>To avoid deployment issues and make Rails applications more self-contained, it's possible to place copies of all of the gems that your Rails application requires in <code>/vendor/gems</code>. This capability first appeared in Rails 2.1, but it's much more flexible and robust in Rails 2.2, handling complicated dependencies between gems. Gem management in Rails includes these commands:</p>
600
+ <ul>
601
+ <li>
602
+ <code>config.gem _gem_name_</code> in your <code>config/environment.rb</code> file</li>
603
+ <li>
604
+ <code>rake gems</code> 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)</li>
605
+ <li>
606
+ <code>rake gems:install</code> to install missing gems to the computer</li>
607
+ <li>
608
+ <code>rake gems:unpack</code> to place a copy of the required gems into <code>/vendor/gems</code>
609
+ </li>
610
+ <li>
611
+ <code>rake gems:unpack:dependencies</code> to get copies of the required gems and their dependencies into <code>/vendor/gems</code>
612
+ </li>
613
+ <li>
614
+ <code>rake gems:build</code> to build any missing native extensions</li>
615
+ <li>
616
+ <code>rake gems:refresh_specs</code> to bring vendored gems created with Rails 2.1 into alignment with the Rails 2.2 way of storing them</li>
617
+ </ul>
618
+ <p>You can unpack or install a single gem by specifying <code>GEM=_gem_name_</code> on the command line.</p>
619
+ <ul>
620
+ <li>Lead Contributor: <a href="http://github.com/al2o3cr">Matt Jones</a>
621
+ </li>
622
+ <li>More information:
623
+
624
+ <ul>
625
+ <li><a href="http://ryandaigle.com/articles/2008/4/1/what-s-new-in-edge-rails-gem-dependencies">What's New in Edge Rails: Gem Dependencies</a></li>
626
+ <li><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></li>
627
+ <li><a href="http://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/1128">Detailed discussion on Lighthouse</a></li>
628
+ </ul>
629
+ </li>
630
+ </ul>
631
+ <h4 id="other-railties-changes">10.2 Other Railties Changes</h4>
632
+ <ul>
633
+ <li>If you're a fan of the <a href="http://code.macournoyer.com/thin/">Thin</a> web server, you'll be happy to know that <code>script/server</code> now supports Thin directly.</li>
634
+ <li>
635
+ <code>script/plugin install &amp;lt;plugin&amp;gt; -r &amp;lt;revision&amp;gt;</code> now works with git-based as well as svn-based plugins.</li>
636
+ <li>
637
+ <code>script/console</code> now supports a <code>--debugger</code> option</li>
638
+ <li>Instructions for setting up a continuous integration server to build Rails itself are included in the Rails source</li>
639
+ <li>
640
+ <code>rake notes:custom ANNOTATION=MYFLAG</code> lets you list out custom annotations.</li>
641
+ <li>Wrapped <code>Rails.env</code> in <code>StringInquirer</code> so you can do <code>Rails.env.development?</code>
642
+ </li>
643
+ <li>To eliminate deprecation warnings and properly handle gem dependencies, Rails now requires rubygems 1.3.1 or higher.</li>
644
+ </ul>
645
+ <h3 id="deprecated">11 Deprecated</h3><p>A few pieces of older code are deprecated in this release:</p>
646
+ <ul>
647
+ <li>
648
+ <code>Rails::SecretKeyGenerator</code> has been replaced by <code>ActiveSupport::SecureRandom</code>
649
+ </li>
650
+ <li>
651
+ <code>render_component</code> is deprecated. There's a <a href="http://github.com/rails/render_component/tree/master">render_components plugin</a> available if you need this functionality.</li>
652
+ <li>
653
+ <p>Implicit local assignments when rendering partials has been deprecated.</p>
654
+ <div class="code_container">
655
+ <pre class="brush: ruby; gutter: false; toolbar: false">
656
+ def partial_with_implicit_local_assignment
657
+ @customer = Customer.new("Marcel")
658
+ render :partial =&gt; "customer"
659
+ end
660
+
661
+ </pre>
662
+ </div>
663
+ <p>Previously the above code made available a local variable called <code>customer</code> inside the partial 'customer'. You should explicitly pass all the variables via :locals hash now.</p>
664
+ </li>
665
+ <li><p><code>country_select</code> 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>
666
+ <li><p><code>ActiveRecord::Base.allow_concurrency</code> no longer has any effect.</p></li>
667
+ <li><p><code>ActiveRecord::Errors.default_error_messages</code> has been deprecated in favor of <code>I18n.translate('activerecord.errors.messages')</code></p></li>
668
+ <li><p>The <code>%s</code> and <code>%d</code> interpolation syntax for internationalization is deprecated.</p></li>
669
+ <li><p><code>String#chars</code> has been deprecated in favor of <code>String#mb_chars</code>.</p></li>
670
+ <li><p>Durations of fractional months or fractional years are deprecated. Use Ruby's core <code>Date</code> and <code>Time</code> class arithmetic instead.</p></li>
671
+ <li><p><code>Request#relative_url_root</code> is deprecated. Use <code>ActionController::Base.relative_url_root</code> instead.</p></li>
672
+ </ul>
673
+ <h3 id="credits">12 Credits</h3><p>Release notes compiled by <a href="http://afreshcup.com">Mike Gunderloy</a></p>
674
+
675
+ <h3>Feedback</h3>
676
+ <p>
677
+ You're encouraged to help improve the quality of this guide.
678
+ </p>
679
+ <p>
680
+ Please contribute if you see any typos or factual errors.
681
+ To get started, you can read our <a href="http://edgeguides.rubyonrails.org/contributing_to_ruby_on_rails.html#contributing-to-the-rails-documentation">documentation contributions</a> section.
682
+ </p>
683
+ <p>
684
+ You may also find incomplete content, or stuff that is not up to date.
685
+ Please do add any missing documentation for master. Make sure to check
686
+ <a href="http://edgeguides.rubyonrails.org">Edge Guides</a> first to verify
687
+ if the issues are already fixed or not on the master branch.
688
+ Check the <a href="ruby_on_rails_guides_guidelines.html">Ruby on Rails Guides Guidelines</a>
689
+ for style and conventions.
690
+ </p>
691
+ <p>
692
+ If for whatever reason you spot something to fix but cannot patch it yourself, please
693
+ <a href="https://github.com/rails/rails/issues">open an issue</a>.
694
+ </p>
695
+ <p>And last but not least, any kind of discussion regarding Ruby on Rails
696
+ documentation is very welcome in the <a href="http://groups.google.com/group/rubyonrails-docs">rubyonrails-docs mailing list</a>.
697
+ </p>
698
+ </div>
699
+ </div>
700
+ </div>
701
+
702
+ <hr class="hide" />
703
+ <div id="footer">
704
+ <div class="wrapper">
705
+ <p>This work is licensed under a <a href="https://creativecommons.org/licenses/by-sa/4.0/">Creative Commons Attribution-ShareAlike 4.0 International</a> License</p>
706
+ <p>"Rails", "Ruby on Rails", and the Rails logo are trademarks of David Heinemeier Hansson. All rights reserved.</p>
707
+
708
+ </div>
709
+ </div>
710
+
711
+ <script type="text/javascript" src="javascripts/jquery.min.js"></script>
712
+ <script type="text/javascript" src="javascripts/responsive-tables.js"></script>
713
+ <script type="text/javascript" src="javascripts/guides.js"></script>
714
+ <script type="text/javascript" src="javascripts/syntaxhighlighter/shCore.js"></script>
715
+ <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushRuby.js"></script>
716
+ <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushXml.js"></script>
717
+ <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushSql.js"></script>
718
+ <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushPlain.js"></script>
719
+ <script type="text/javascript">
720
+ SyntaxHighlighter.all();
721
+ $(guidesIndex.bind);
722
+ </script>
723
+ </body>
724
+ </html>