rails 4.2.0.beta4 → 4.2.0.rc1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (230) hide show
  1. checksums.yaml +4 -4
  2. data/guides/Rakefile +3 -1
  3. data/guides/bug_report_templates/action_controller_gem.rb +2 -2
  4. data/guides/bug_report_templates/action_controller_master.rb +2 -2
  5. data/guides/source/3_0_release_notes.md +2 -2
  6. data/guides/source/4_1_release_notes.md +1 -1
  7. data/guides/source/4_2_release_notes.md +250 -225
  8. data/guides/source/_welcome.html.erb +1 -1
  9. data/guides/source/action_controller_overview.md +6 -6
  10. data/guides/source/action_mailer_basics.md +26 -11
  11. data/guides/source/action_view_overview.md +0 -1
  12. data/guides/source/active_job_basics.md +29 -23
  13. data/guides/source/active_record_postgresql.md +2 -7
  14. data/guides/source/active_record_validations.md +1 -0
  15. data/guides/source/active_support_core_extensions.md +1 -1
  16. data/guides/source/active_support_instrumentation.md +5 -5
  17. data/guides/source/asset_pipeline.md +2 -2
  18. data/guides/source/association_basics.md +0 -2
  19. data/guides/source/command_line.md +6 -15
  20. data/guides/source/configuring.md +4 -4
  21. data/guides/source/documents.yaml +0 -1
  22. data/guides/source/engines.md +26 -15
  23. data/guides/source/form_helpers.md +10 -2
  24. data/guides/source/getting_started.md +9 -9
  25. data/guides/source/rails_on_rack.md +2 -2
  26. data/guides/source/ruby_on_rails_guides_guidelines.md +1 -0
  27. data/guides/source/security.md +1 -1
  28. data/guides/source/testing.md +80 -13
  29. data/guides/source/upgrading_ruby_on_rails.md +23 -20
  30. metadata +29 -229
  31. data/guides/output/2_2_release_notes.html +0 -724
  32. data/guides/output/2_3_release_notes.html +0 -870
  33. data/guides/output/3_0_release_notes.html +0 -773
  34. data/guides/output/3_1_release_notes.html +0 -740
  35. data/guides/output/3_2_release_notes.html +0 -797
  36. data/guides/output/4_0_release_notes.html +0 -523
  37. data/guides/output/4_1_release_notes.html +0 -806
  38. data/guides/output/4_2_release_notes.html +0 -728
  39. data/guides/output/Gemfile +0 -6
  40. data/guides/output/_license.html +0 -226
  41. data/guides/output/_welcome.html +0 -233
  42. data/guides/output/action_controller_overview.html +0 -1335
  43. data/guides/output/action_mailer_basics.html +0 -928
  44. data/guides/output/action_view_overview.html +0 -1509
  45. data/guides/output/active_job_basics.html +0 -546
  46. data/guides/output/active_model_basics.html +0 -438
  47. data/guides/output/active_record_basics.html +0 -594
  48. data/guides/output/active_record_callbacks.html +0 -592
  49. data/guides/output/active_record_migrations.html +0 -1123
  50. data/guides/output/active_record_postgresql.html +0 -675
  51. data/guides/output/active_record_querying.html +0 -1796
  52. data/guides/output/active_record_validations.html +0 -1301
  53. data/guides/output/active_support_core_extensions.html +0 -3450
  54. data/guides/output/active_support_instrumentation.html +0 -1121
  55. data/guides/output/api_documentation_guidelines.html +0 -498
  56. data/guides/output/asset_pipeline.html +0 -1167
  57. data/guides/output/association_basics.html +0 -2086
  58. data/guides/output/caching_with_rails.html +0 -553
  59. data/guides/output/command_line.html +0 -791
  60. data/guides/output/configuring.html +0 -1055
  61. data/guides/output/contributing_to_ruby_on_rails.html +0 -657
  62. data/guides/output/credits.html +0 -284
  63. data/guides/output/debugging_rails_applications.html +0 -1014
  64. data/guides/output/development_dependencies_install.html +0 -478
  65. data/guides/output/engines.html +0 -1438
  66. data/guides/output/form_helpers.html +0 -1074
  67. data/guides/output/generators.html +0 -838
  68. data/guides/output/getting_started.html +0 -2092
  69. data/guides/output/i18n.html +0 -1198
  70. data/guides/output/images/akshaysurve.jpg +0 -0
  71. data/guides/output/images/belongs_to.png +0 -0
  72. data/guides/output/images/book_icon.gif +0 -0
  73. data/guides/output/images/bullet.gif +0 -0
  74. data/guides/output/images/chapters_icon.gif +0 -0
  75. data/guides/output/images/check_bullet.gif +0 -0
  76. data/guides/output/images/credits_pic_blank.gif +0 -0
  77. data/guides/output/images/csrf.png +0 -0
  78. data/guides/output/images/edge_badge.png +0 -0
  79. data/guides/output/images/favicon.ico +0 -0
  80. data/guides/output/images/feature_tile.gif +0 -0
  81. data/guides/output/images/footer_tile.gif +0 -0
  82. data/guides/output/images/fxn.png +0 -0
  83. data/guides/output/images/getting_started/article_with_comments.png +0 -0
  84. data/guides/output/images/getting_started/challenge.png +0 -0
  85. data/guides/output/images/getting_started/confirm_dialog.png +0 -0
  86. data/guides/output/images/getting_started/forbidden_attributes_for_new_article.png +0 -0
  87. data/guides/output/images/getting_started/forbidden_attributes_for_new_post.png +0 -0
  88. data/guides/output/images/getting_started/form_with_errors.png +0 -0
  89. data/guides/output/images/getting_started/index_action_with_edit_link.png +0 -0
  90. data/guides/output/images/getting_started/new_article.png +0 -0
  91. data/guides/output/images/getting_started/new_post.png +0 -0
  92. data/guides/output/images/getting_started/post_with_comments.png +0 -0
  93. data/guides/output/images/getting_started/rails_welcome.png +0 -0
  94. data/guides/output/images/getting_started/routing_error_no_controller.png +0 -0
  95. data/guides/output/images/getting_started/routing_error_no_route_matches.png +0 -0
  96. data/guides/output/images/getting_started/show_action_for_articles.png +0 -0
  97. data/guides/output/images/getting_started/show_action_for_posts.png +0 -0
  98. data/guides/output/images/getting_started/template_is_missing_articles_new.png +0 -0
  99. data/guides/output/images/getting_started/template_is_missing_posts_new.png +0 -0
  100. data/guides/output/images/getting_started/undefined_method_post_path.png +0 -0
  101. data/guides/output/images/getting_started/unknown_action_create_for_articles.png +0 -0
  102. data/guides/output/images/getting_started/unknown_action_create_for_posts.png +0 -0
  103. data/guides/output/images/getting_started/unknown_action_new_for_articles.png +0 -0
  104. data/guides/output/images/getting_started/unknown_action_new_for_posts.png +0 -0
  105. data/guides/output/images/grey_bullet.gif +0 -0
  106. data/guides/output/images/habtm.png +0 -0
  107. data/guides/output/images/has_many.png +0 -0
  108. data/guides/output/images/has_many_through.png +0 -0
  109. data/guides/output/images/has_one.png +0 -0
  110. data/guides/output/images/has_one_through.png +0 -0
  111. data/guides/output/images/header_backdrop.png +0 -0
  112. data/guides/output/images/header_tile.gif +0 -0
  113. data/guides/output/images/i18n/demo_html_safe.png +0 -0
  114. data/guides/output/images/i18n/demo_localized_pirate.png +0 -0
  115. data/guides/output/images/i18n/demo_translated_en.png +0 -0
  116. data/guides/output/images/i18n/demo_translated_pirate.png +0 -0
  117. data/guides/output/images/i18n/demo_translation_missing.png +0 -0
  118. data/guides/output/images/i18n/demo_untranslated.png +0 -0
  119. data/guides/output/images/icons/README +0 -5
  120. data/guides/output/images/icons/callouts/1.png +0 -0
  121. data/guides/output/images/icons/callouts/10.png +0 -0
  122. data/guides/output/images/icons/callouts/11.png +0 -0
  123. data/guides/output/images/icons/callouts/12.png +0 -0
  124. data/guides/output/images/icons/callouts/13.png +0 -0
  125. data/guides/output/images/icons/callouts/14.png +0 -0
  126. data/guides/output/images/icons/callouts/15.png +0 -0
  127. data/guides/output/images/icons/callouts/2.png +0 -0
  128. data/guides/output/images/icons/callouts/3.png +0 -0
  129. data/guides/output/images/icons/callouts/4.png +0 -0
  130. data/guides/output/images/icons/callouts/5.png +0 -0
  131. data/guides/output/images/icons/callouts/6.png +0 -0
  132. data/guides/output/images/icons/callouts/7.png +0 -0
  133. data/guides/output/images/icons/callouts/8.png +0 -0
  134. data/guides/output/images/icons/callouts/9.png +0 -0
  135. data/guides/output/images/icons/caution.png +0 -0
  136. data/guides/output/images/icons/example.png +0 -0
  137. data/guides/output/images/icons/home.png +0 -0
  138. data/guides/output/images/icons/important.png +0 -0
  139. data/guides/output/images/icons/next.png +0 -0
  140. data/guides/output/images/icons/note.png +0 -0
  141. data/guides/output/images/icons/prev.png +0 -0
  142. data/guides/output/images/icons/tip.png +0 -0
  143. data/guides/output/images/icons/up.png +0 -0
  144. data/guides/output/images/icons/warning.png +0 -0
  145. data/guides/output/images/nav_arrow.gif +0 -0
  146. data/guides/output/images/oscardelben.jpg +0 -0
  147. data/guides/output/images/polymorphic.png +0 -0
  148. data/guides/output/images/radar.png +0 -0
  149. data/guides/output/images/rails4_features.png +0 -0
  150. data/guides/output/images/rails_guides_kindle_cover.jpg +0 -0
  151. data/guides/output/images/rails_guides_logo.gif +0 -0
  152. data/guides/output/images/rails_logo_remix.gif +0 -0
  153. data/guides/output/images/session_fixation.png +0 -0
  154. data/guides/output/images/tab_grey.gif +0 -0
  155. data/guides/output/images/tab_info.gif +0 -0
  156. data/guides/output/images/tab_note.gif +0 -0
  157. data/guides/output/images/tab_red.gif +0 -0
  158. data/guides/output/images/tab_yellow.gif +0 -0
  159. data/guides/output/images/tab_yellow.png +0 -0
  160. data/guides/output/images/vijaydev.jpg +0 -0
  161. data/guides/output/index.html +0 -354
  162. data/guides/output/initialization.html +0 -876
  163. data/guides/output/javascripts/guides.js +0 -59
  164. data/guides/output/javascripts/jquery.min.js +0 -4
  165. data/guides/output/javascripts/responsive-tables.js +0 -43
  166. data/guides/output/javascripts/syntaxhighlighter/shBrushAS3.js +0 -59
  167. data/guides/output/javascripts/syntaxhighlighter/shBrushAppleScript.js +0 -75
  168. data/guides/output/javascripts/syntaxhighlighter/shBrushBash.js +0 -59
  169. data/guides/output/javascripts/syntaxhighlighter/shBrushCSharp.js +0 -65
  170. data/guides/output/javascripts/syntaxhighlighter/shBrushColdFusion.js +0 -100
  171. data/guides/output/javascripts/syntaxhighlighter/shBrushCpp.js +0 -97
  172. data/guides/output/javascripts/syntaxhighlighter/shBrushCss.js +0 -91
  173. data/guides/output/javascripts/syntaxhighlighter/shBrushDelphi.js +0 -55
  174. data/guides/output/javascripts/syntaxhighlighter/shBrushDiff.js +0 -41
  175. data/guides/output/javascripts/syntaxhighlighter/shBrushErlang.js +0 -52
  176. data/guides/output/javascripts/syntaxhighlighter/shBrushGroovy.js +0 -67
  177. data/guides/output/javascripts/syntaxhighlighter/shBrushJScript.js +0 -52
  178. data/guides/output/javascripts/syntaxhighlighter/shBrushJava.js +0 -57
  179. data/guides/output/javascripts/syntaxhighlighter/shBrushJavaFX.js +0 -58
  180. data/guides/output/javascripts/syntaxhighlighter/shBrushPerl.js +0 -72
  181. data/guides/output/javascripts/syntaxhighlighter/shBrushPhp.js +0 -88
  182. data/guides/output/javascripts/syntaxhighlighter/shBrushPlain.js +0 -33
  183. data/guides/output/javascripts/syntaxhighlighter/shBrushPowerShell.js +0 -74
  184. data/guides/output/javascripts/syntaxhighlighter/shBrushPython.js +0 -64
  185. data/guides/output/javascripts/syntaxhighlighter/shBrushRuby.js +0 -55
  186. data/guides/output/javascripts/syntaxhighlighter/shBrushSass.js +0 -94
  187. data/guides/output/javascripts/syntaxhighlighter/shBrushScala.js +0 -51
  188. data/guides/output/javascripts/syntaxhighlighter/shBrushSql.js +0 -66
  189. data/guides/output/javascripts/syntaxhighlighter/shBrushVb.js +0 -56
  190. data/guides/output/javascripts/syntaxhighlighter/shBrushXml.js +0 -69
  191. data/guides/output/javascripts/syntaxhighlighter/shCore.js +0 -17
  192. data/guides/output/layout.html +0 -448
  193. data/guides/output/layouts_and_rendering.html +0 -1541
  194. data/guides/output/maintenance_policy.html +0 -257
  195. data/guides/output/migrations.html +0 -1360
  196. data/guides/output/nested_model_forms.html +0 -412
  197. data/guides/output/plugins.html +0 -644
  198. data/guides/output/rails_application_templates.html +0 -450
  199. data/guides/output/rails_on_rack.html +0 -547
  200. data/guides/output/routing.html +0 -1631
  201. data/guides/output/ruby_on_rails_guides_guidelines.html +0 -329
  202. data/guides/output/security.html +0 -935
  203. data/guides/output/stylesheets/fixes.css +0 -16
  204. data/guides/output/stylesheets/kindle.css +0 -11
  205. data/guides/output/stylesheets/main.css +0 -713
  206. data/guides/output/stylesheets/print.css +0 -52
  207. data/guides/output/stylesheets/reset.css +0 -43
  208. data/guides/output/stylesheets/responsive-tables.css +0 -50
  209. data/guides/output/stylesheets/style.css +0 -13
  210. data/guides/output/stylesheets/syntaxhighlighter/shCore.css +0 -226
  211. data/guides/output/stylesheets/syntaxhighlighter/shCoreDefault.css +0 -328
  212. data/guides/output/stylesheets/syntaxhighlighter/shCoreDjango.css +0 -331
  213. data/guides/output/stylesheets/syntaxhighlighter/shCoreEclipse.css +0 -339
  214. data/guides/output/stylesheets/syntaxhighlighter/shCoreEmacs.css +0 -324
  215. data/guides/output/stylesheets/syntaxhighlighter/shCoreFadeToGrey.css +0 -328
  216. data/guides/output/stylesheets/syntaxhighlighter/shCoreMDUltra.css +0 -324
  217. data/guides/output/stylesheets/syntaxhighlighter/shCoreMidnight.css +0 -324
  218. data/guides/output/stylesheets/syntaxhighlighter/shCoreRDark.css +0 -324
  219. data/guides/output/stylesheets/syntaxhighlighter/shThemeDefault.css +0 -117
  220. data/guides/output/stylesheets/syntaxhighlighter/shThemeDjango.css +0 -120
  221. data/guides/output/stylesheets/syntaxhighlighter/shThemeEclipse.css +0 -128
  222. data/guides/output/stylesheets/syntaxhighlighter/shThemeEmacs.css +0 -113
  223. data/guides/output/stylesheets/syntaxhighlighter/shThemeFadeToGrey.css +0 -117
  224. data/guides/output/stylesheets/syntaxhighlighter/shThemeMDUltra.css +0 -113
  225. data/guides/output/stylesheets/syntaxhighlighter/shThemeMidnight.css +0 -113
  226. data/guides/output/stylesheets/syntaxhighlighter/shThemeRDark.css +0 -113
  227. data/guides/output/stylesheets/syntaxhighlighter/shThemeRailsGuides.css +0 -116
  228. data/guides/output/testing.html +0 -1350
  229. data/guides/output/upgrading_ruby_on_rails.html +0 -1135
  230. data/guides/output/working_with_javascript_in_rails.html +0 -587
@@ -1,797 +0,0 @@
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 3.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 3.2 Release Notes</h2><p>Highlights in Rails 3.2:</p>
165
- <ul>
166
- <li>Faster Development Mode</li>
167
- <li>New Routing Engine</li>
168
- <li>Automatic Query Explains</li>
169
- <li>Tagged Logging</li>
170
- </ul>
171
- <p>These release notes cover the major changes, but do not include each bug-fix and changes. If you want to see everything, check out the <a href="https://github.com/rails/rails/commits/3-2-stable">list of commits</a> in the main Rails repository on GitHub.</p>
172
-
173
- <div id="subCol">
174
- <h3 class="chapter"><img src="images/chapters_icon.gif" alt="" />Chapters</h3>
175
- <ol class="chapters">
176
- <li>
177
- <a href="#upgrading-to-rails-3.2">Upgrading to Rails 3.2</a>
178
-
179
- <ul>
180
- <li><a href="#rails-3.2-requires-at-least-ruby-1.8.7">Rails 3.2 requires at least Ruby 1.8.7</a></li>
181
- <li><a href="#what-to-update-in-your-apps">What to update in your apps</a></li>
182
- <li><a href="#what-to-update-in-your-engines">What to update in your engines</a></li>
183
- </ul>
184
- </li>
185
- <li>
186
- <a href="#creating-a-rails-3.2-application">Creating a Rails 3.2 application</a>
187
-
188
- <ul>
189
- <li><a href="#vendoring-gems">Vendoring Gems</a></li>
190
- <li><a href="#living-on-the-edge">Living on the Edge</a></li>
191
- </ul>
192
- </li>
193
- <li>
194
- <a href="#major-features">Major Features</a>
195
-
196
- <ul>
197
- <li><a href="#faster-development-mode-&amp;-routing">Faster Development Mode &amp; Routing</a></li>
198
- <li><a href="#automatic-query-explains">Automatic Query Explains</a></li>
199
- <li><a href="#tagged-logging">Tagged Logging</a></li>
200
- </ul>
201
- </li>
202
- <li><a href="#documentation">Documentation</a></li>
203
- <li><a href="#railties">Railties</a></li>
204
- <li><a href="#action-mailer">Action Mailer</a></li>
205
- <li>
206
- <a href="#action-pack">Action Pack</a>
207
-
208
- <ul>
209
- <li><a href="#action-controller">Action Controller</a></li>
210
- <li><a href="#action-dispatch">Action Dispatch</a></li>
211
- <li><a href="#action-view">Action View</a></li>
212
- <li><a href="#sprockets">Sprockets</a></li>
213
- </ul>
214
- </li>
215
- <li>
216
- <a href="#active-record">Active Record</a>
217
-
218
- <ul>
219
- <li><a href="#active-record-deprecations">Deprecations</a></li>
220
- </ul>
221
- </li>
222
- <li>
223
- <a href="#active-model">Active Model</a>
224
-
225
- <ul>
226
- <li><a href="#active-model-deprecations">Deprecations</a></li>
227
- </ul>
228
- </li>
229
- <li><a href="#active-resource">Active Resource</a></li>
230
- <li>
231
- <a href="#active-support">Active Support</a>
232
-
233
- <ul>
234
- <li><a href="#deprecations">Deprecations</a></li>
235
- </ul>
236
- </li>
237
- <li><a href="#credits">Credits</a></li>
238
- </ol>
239
-
240
- </div>
241
-
242
- </div>
243
- </div>
244
-
245
- <div id="container">
246
- <div class="wrapper">
247
- <div id="mainCol">
248
- <h3 id="upgrading-to-rails-3.2">1 Upgrading to Rails 3.2</h3><p>If you're upgrading an existing application, it's a great idea to have good test coverage before going in. You should also first upgrade to Rails 3.1 in case you haven't and make sure your application still runs as expected before attempting an update to Rails 3.2. Then take heed of the following changes:</p><h4 id="rails-3.2-requires-at-least-ruby-1.8.7">1.1 Rails 3.2 requires at least Ruby 1.8.7</h4><p>Rails 3.2 requires Ruby 1.8.7 or higher. Support for all of the previous Ruby versions has been dropped officially and you should upgrade as early as possible. Rails 3.2 is also compatible with Ruby 1.9.2.</p><div class="info"><p>Note that Ruby 1.8.7 p248 and p249 have marshalling bugs that crash Rails. Ruby Enterprise Edition has these fixed since the release of 1.8.7-2010.02. On the 1.9 front, Ruby 1.9.1 is not usable because it outright segfaults, so if you want to use 1.9.x, jump on to 1.9.2 or 1.9.3 for smooth sailing.</p></div><h4 id="what-to-update-in-your-apps">1.2 What to update in your apps</h4>
249
- <ul>
250
- <li>
251
- <p>Update your Gemfile to depend on</p>
252
- <ul>
253
- <li><code>rails = 3.2.0</code></li>
254
- <li><code>sass-rails ~&gt; 3.2.3</code></li>
255
- <li><code>coffee-rails ~&gt; 3.2.1</code></li>
256
- <li><code>uglifier &gt;= 1.0.3</code></li>
257
- </ul>
258
- </li>
259
- <li><p>Rails 3.2 deprecates <code>vendor/plugins</code> and Rails 4.0 will remove them completely. You can start replacing these plugins by extracting them as gems and adding them in your Gemfile. If you choose not to make them gems, you can move them into, say, <code>lib/my_plugin/*</code> and add an appropriate initializer in <code>config/initializers/my_plugin.rb</code>.</p></li>
260
- <li>
261
- <p>There are a couple of new configuration changes you'd want to add in <code>config/environments/development.rb</code>:</p>
262
- <div class="code_container">
263
- <pre class="brush: ruby; gutter: false; toolbar: false">
264
- # Raise exception on mass assignment protection for Active Record models
265
- config.active_record.mass_assignment_sanitizer = :strict
266
-
267
- # Log the query plan for queries taking more than this (works
268
- # with SQLite, MySQL, and PostgreSQL)
269
- config.active_record.auto_explain_threshold_in_seconds = 0.5
270
-
271
- </pre>
272
- </div>
273
- <p>The <code>mass_assignment_sanitizer</code> config also needs to be added in <code>config/environments/test.rb</code>:</p>
274
- <div class="code_container">
275
- <pre class="brush: ruby; gutter: false; toolbar: false">
276
- # Raise exception on mass assignment protection for Active Record models
277
- config.active_record.mass_assignment_sanitizer = :strict
278
-
279
- </pre>
280
- </div>
281
- </li>
282
- </ul>
283
- <h4 id="what-to-update-in-your-engines">1.3 What to update in your engines</h4><p>Replace the code beneath the comment in <code>script/rails</code> with the following content:</p><div class="code_container">
284
- <pre class="brush: ruby; gutter: false; toolbar: false">
285
- ENGINE_ROOT = File.expand_path('../..', __FILE__)
286
- ENGINE_PATH = File.expand_path('../../lib/your_engine_name/engine', __FILE__)
287
-
288
- require 'rails/all'
289
- require 'rails/engine/commands'
290
-
291
- </pre>
292
- </div>
293
- <h3 id="creating-a-rails-3.2-application">2 Creating a Rails 3.2 application</h3><div class="code_container">
294
- <pre class="brush: plain; gutter: false; toolbar: false">
295
- # You should have the 'rails' RubyGem installed
296
- $ rails new myapp
297
- $ cd myapp
298
-
299
- </pre>
300
- </div>
301
- <h4 id="vendoring-gems">2.1 Vendoring Gems</h4><p>Rails now uses a <code>Gemfile</code> in the application root to determine the gems you require for your application to start. This <code>Gemfile</code> is processed by the <a href="https://github.com/carlhuda/bundler">Bundler</a> gem, which then installs all your dependencies. It can even install all the dependencies locally to your application so that it doesn't depend on the system gems.</p><p>More information: <a href="http://gembundler.com">Bundler homepage</a></p><h4 id="living-on-the-edge">2.2 Living on the Edge</h4><p><code>Bundler</code> and <code>Gemfile</code> makes freezing your Rails application easy as pie with the new dedicated <code>bundle</code> command. If you want to bundle straight from the Git repository, you can pass the <code>--edge</code> flag:</p><div class="code_container">
302
- <pre class="brush: plain; gutter: false; toolbar: false">
303
- $ rails new myapp --edge
304
-
305
- </pre>
306
- </div>
307
- <p>If you have a local checkout of the Rails repository and want to generate an application using that, you can pass the <code>--dev</code> flag:</p><div class="code_container">
308
- <pre class="brush: plain; gutter: false; toolbar: false">
309
- $ ruby /path/to/rails/railties/bin/rails new myapp --dev
310
-
311
- </pre>
312
- </div>
313
- <h3 id="major-features">3 Major Features</h3><h4 id="faster-development-mode-&amp;-routing">3.1 Faster Development Mode &amp; Routing</h4><p>Rails 3.2 comes with a development mode that's noticeably faster. Inspired by <a href="https://github.com/paneq/active_reload">Active Reload</a>, Rails reloads classes only when files actually change. The performance gains are dramatic on a larger application. Route recognition also got a bunch faster thanks to the new <a href="https://github.com/rails/journey">Journey</a> engine.</p><h4 id="automatic-query-explains">3.2 Automatic Query Explains</h4><p>Rails 3.2 comes with a nice feature that explains queries generated by Arel by defining an <code>explain</code> method in <code>ActiveRecord::Relation</code>. For example, you can run something like <code>puts Person.active.limit(5).explain</code> and the query Arel produces is explained. This allows to check for the proper indexes and further optimizations.</p><p>Queries that take more than half a second to run are <em>automatically</em> explained in the development mode. This threshold, of course, can be changed.</p><h4 id="tagged-logging">3.3 Tagged Logging</h4><p>When running a multi-user, multi-account application, it's a great help to be able to filter the log by who did what. TaggedLogging in Active Support helps in doing exactly that by stamping log lines with subdomains, request ids, and anything else to aid debugging such applications.</p><h3 id="documentation">4 Documentation</h3><p>From Rails 3.2, the Rails guides are available for the Kindle and free Kindle Reading Apps for the iPad, iPhone, Mac, Android, etc.</p><h3 id="railties">5 Railties</h3>
314
- <ul>
315
- <li><p>Speed up development by only reloading classes if dependencies files changed. This can be turned off by setting <code>config.reload_classes_only_on_change</code> to false.</p></li>
316
- <li><p>New applications get a flag <code>config.active_record.auto_explain_threshold_in_seconds</code> in the environments configuration files. With a value of <code>0.5</code> in <code>development.rb</code> and commented out in <code>production.rb</code>. No mention in <code>test.rb</code>.</p></li>
317
- <li><p>Added <code>config.exceptions_app</code> to set the exceptions application invoked by the <code>ShowException</code> middleware when an exception happens. Defaults to <code>ActionDispatch::PublicExceptions.new(Rails.public_path)</code>.</p></li>
318
- <li><p>Added a <code>DebugExceptions</code> middleware which contains features extracted from <code>ShowExceptions</code> middleware.</p></li>
319
- <li><p>Display mounted engines' routes in <code>rake routes</code>.</p></li>
320
- <li>
321
- <p>Allow to change the loading order of railties with <code>config.railties_order</code> like:</p>
322
- <div class="code_container">
323
- <pre class="brush: ruby; gutter: false; toolbar: false">
324
- config.railties_order = [Blog::Engine, :main_app, :all]
325
-
326
- </pre>
327
- </div>
328
- </li>
329
- <li><p>Scaffold returns 204 No Content for API requests without content. This makes scaffold work with jQuery out of the box.</p></li>
330
- <li><p>Update <code>Rails::Rack::Logger</code> middleware to apply any tags set in <code>config.log_tags</code> to <code>ActiveSupport::TaggedLogging</code>. This makes it easy to tag log lines with debug information like subdomain and request id -- both very helpful in debugging multi-user production applications.</p></li>
331
- <li><p>Default options to <code>rails new</code> can be set in <code>~/.railsrc</code>. You can specify extra command-line arguments to be used every time <code>rails new</code> runs in the <code>.railsrc</code> configuration file in your home directory.</p></li>
332
- <li><p>Add an alias <code>d</code> for <code>destroy</code>. This works for engines too.</p></li>
333
- <li><p>Attributes on scaffold and model generators default to string. This allows the following: <code>rails g scaffold Post title body:text author</code></p></li>
334
- <li>
335
- <p>Allow scaffold/model/migration generators to accept "index" and "uniq" modifiers. For example,</p>
336
- <div class="code_container">
337
- <pre class="brush: ruby; gutter: false; toolbar: false">
338
- rails g scaffold Post title:string:index author:uniq price:decimal{7,2}
339
-
340
- </pre>
341
- </div>
342
- <p>will create indexes for <code>title</code> and <code>author</code> with the latter being an unique index. Some types such as decimal accept custom options. In the example, <code>price</code> will be a decimal column with precision and scale set to 7 and 2 respectively.</p>
343
- </li>
344
- <li><p>Turn gem has been removed from default Gemfile.</p></li>
345
- <li><p>Remove old plugin generator <code>rails generate plugin</code> in favor of <code>rails plugin new</code> command.</p></li>
346
- <li><p>Remove old <code>config.paths.app.controller</code> API in favor of <code>config.paths["app/controller"]</code>.</p></li>
347
- </ul>
348
- <h5 id="railties-deprecations">5.1 Deprecations</h5>
349
- <ul>
350
- <li>
351
- <code>Rails::Plugin</code> is deprecated and will be removed in Rails 4.0. Instead of adding plugins to <code>vendor/plugins</code> use gems or bundler with path or git dependencies.</li>
352
- </ul>
353
- <h3 id="action-mailer">6 Action Mailer</h3>
354
- <ul>
355
- <li><p>Upgraded <code>mail</code> version to 2.4.0.</p></li>
356
- <li><p>Removed the old Action Mailer API which was deprecated since Rails 3.0.</p></li>
357
- </ul>
358
- <h3 id="action-pack">7 Action Pack</h3><h4 id="action-controller">7.1 Action Controller</h4>
359
- <ul>
360
- <li><p>Make <code>ActiveSupport::Benchmarkable</code> a default module for <code>ActionController::Base,</code> so the <code>#benchmark</code> method is once again available in the controller context like it used to be.</p></li>
361
- <li><p>Added <code>:gzip</code> option to <code>caches_page</code>. The default option can be configured globally using <code>page_cache_compression</code>.</p></li>
362
- <li>
363
- <p>Rails will now use your default layout (such as "layouts/application") when you specify a layout with <code>:only</code> and <code>:except</code> condition, and those conditions fail.</p>
364
- <div class="code_container">
365
- <pre class="brush: ruby; gutter: false; toolbar: false">
366
- class CarsController
367
- layout 'single_car', :only =&gt; :show
368
- end
369
-
370
- </pre>
371
- </div>
372
- <p>Rails will use <code>layouts/single_car</code> when a request comes in <code>:show</code> action, and use <code>layouts/application</code> (or <code>layouts/cars</code>, if exists) when a request comes in for any other actions.</p>
373
- </li>
374
- <li><p><code>form_for</code> is changed to use <code>#{action}_#{as}</code> as the css class and id if <code>:as</code> option is provided. Earlier versions used <code>#{as}_#{action}</code>.</p></li>
375
- <li><p><code>ActionController::ParamsWrapper</code> on Active Record models now only wrap <code>attr_accessible</code> attributes if they were set. If not, only the attributes returned by the class method <code>attribute_names</code> will be wrapped. This fixes the wrapping of nested attributes by adding them to <code>attr_accessible</code>.</p></li>
376
- <li><p>Log "Filter chain halted as CALLBACKNAME rendered or redirected" every time a before callback halts.</p></li>
377
- <li><p><code>ActionDispatch::ShowExceptions</code> is refactored. The controller is responsible for choosing to show exceptions. It's possible to override <code>show_detailed_exceptions?</code> in controllers to specify which requests should provide debugging information on errors.</p></li>
378
- <li><p>Responders now return 204 No Content for API requests without a response body (as in the new scaffold).</p></li>
379
- <li>
380
- <p><code>ActionController::TestCase</code> cookies is refactored. Assigning cookies for test cases should now use <code>cookies[]</code></p>
381
- <div class="code_container">
382
- <pre class="brush: ruby; gutter: false; toolbar: false">
383
- cookies[:email] = 'user@example.com'
384
- get :index
385
- assert_equal 'user@example.com', cookies[:email]
386
-
387
- </pre>
388
- </div>
389
- <p>To clear the cookies, use <code>clear</code>.</p>
390
- <div class="code_container">
391
- <pre class="brush: ruby; gutter: false; toolbar: false">
392
- cookies.clear
393
- get :index
394
- assert_nil cookies[:email]
395
-
396
- </pre>
397
- </div>
398
- <p>We now no longer write out HTTP_COOKIE and the cookie jar is persistent between requests so if you need to manipulate the environment for your test you need to do it before the cookie jar is created.</p>
399
- </li>
400
- <li><p><code>send_file</code> now guesses the MIME type from the file extension if <code>:type</code> is not provided.</p></li>
401
- <li><p>MIME type entries for PDF, ZIP and other formats were added.</p></li>
402
- <li><p>Allow <code>fresh_when/stale?</code> to take a record instead of an options hash.</p></li>
403
- <li><p>Changed log level of warning for missing CSRF token from <code>:debug</code> to <code>:warn</code>.</p></li>
404
- <li><p>Assets should use the request protocol by default or default to relative if no request is available.</p></li>
405
- </ul>
406
- <h5 id="action-controller-deprecations">7.1.1 Deprecations</h5>
407
- <ul>
408
- <li>
409
- <p>Deprecated implied layout lookup in controllers whose parent had an explicit layout set:</p>
410
- <div class="code_container">
411
- <pre class="brush: ruby; gutter: false; toolbar: false">
412
- class ApplicationController
413
- layout "application"
414
- end
415
-
416
- class PostsController &lt; ApplicationController
417
- end
418
-
419
- </pre>
420
- </div>
421
- <p>In the example above, <code>PostsController</code> will no longer automatically look up for a posts layout. If you need this functionality you could either remove <code>layout "application"</code> from <code>ApplicationController</code> or explicitly set it to <code>nil</code> in <code>PostsController</code>.</p>
422
- </li>
423
- <li><p>Deprecated <code>ActionController::UnknownAction</code> in favor of <code>AbstractController::ActionNotFound</code>.</p></li>
424
- <li><p>Deprecated <code>ActionController::DoubleRenderError</code> in favor of <code>AbstractController::DoubleRenderError</code>.</p></li>
425
- <li><p>Deprecated <code>method_missing</code> in favor of <code>action_missing</code> for missing actions.</p></li>
426
- <li><p>Deprecated <code>ActionController#rescue_action</code>, <code>ActionController#initialize_template_class</code> and <code>ActionController#assign_shortcuts</code>.</p></li>
427
- </ul>
428
- <h4 id="action-dispatch">7.2 Action Dispatch</h4>
429
- <ul>
430
- <li><p>Add <code>config.action_dispatch.default_charset</code> to configure default charset for <code>ActionDispatch::Response</code>.</p></li>
431
- <li><p>Added <code>ActionDispatch::RequestId</code> middleware that'll make a unique X-Request-Id header available to the response and enables the <code>ActionDispatch::Request#uuid</code> method. This makes it easy to trace requests from end-to-end in the stack and to identify individual requests in mixed logs like Syslog.</p></li>
432
- <li><p>The <code>ShowExceptions</code> middleware now accepts an exceptions application that is responsible to render an exception when the application fails. The application is invoked with a copy of the exception in <code>env["action_dispatch.exception"]</code> and with the <code>PATH_INFO</code> rewritten to the status code.</p></li>
433
- <li><p>Allow rescue responses to be configured through a railtie as in <code>config.action_dispatch.rescue_responses</code>.</p></li>
434
- </ul>
435
- <h5 id="action-dispatch-deprecations">7.2.1 Deprecations</h5>
436
- <ul>
437
- <li>Deprecated the ability to set a default charset at the controller level, use the new <code>config.action_dispatch.default_charset</code> instead.</li>
438
- </ul>
439
- <h4 id="action-view">7.3 Action View</h4>
440
- <ul>
441
- <li>
442
- <p>Add <code>button_tag</code> support to <code>ActionView::Helpers::FormBuilder</code>. This support mimics the default behavior of <code>submit_tag</code>.</p>
443
- <div class="code_container">
444
- <pre class="brush: ruby; html-script: true; gutter: false; toolbar: false">
445
- &lt;%= form_for @post do |f| %&gt;
446
- &lt;%= f.button %&gt;
447
- &lt;% end %&gt;
448
-
449
- </pre>
450
- </div>
451
- </li>
452
- <li><p>Date helpers accept a new option <code>:use_two_digit_numbers =&gt; true</code>, that renders select boxes for months and days with a leading zero without changing the respective values. For example, this is useful for displaying ISO 8601-style dates such as '2011-08-01'.</p></li>
453
- <li>
454
- <p>You can provide a namespace for your form to ensure uniqueness of id attributes on form elements. The namespace attribute will be prefixed with underscore on the generated HTML id.</p>
455
- <div class="code_container">
456
- <pre class="brush: ruby; html-script: true; gutter: false; toolbar: false">
457
- &lt;%= form_for(@offer, :namespace =&gt; 'namespace') do |f| %&gt;
458
- &lt;%= f.label :version, 'Version' %&gt;:
459
- &lt;%= f.text_field :version %&gt;
460
- &lt;% end %&gt;
461
-
462
- </pre>
463
- </div>
464
- </li>
465
- <li><p>Limit the number of options for <code>select_year</code> to 1000. Pass <code>:max_years_allowed</code> option to set your own limit.</p></li>
466
- <li>
467
- <p><code>content_tag_for</code> and <code>div_for</code> can now take a collection of records. It will also yield the record as the first argument if you set a receiving argument in your block. So instead of having to do this:</p>
468
- <div class="code_container">
469
- <pre class="brush: ruby; gutter: false; toolbar: false">
470
- @items.each do |item|
471
- content_tag_for(:li, item) do
472
- Title: &lt;%= item.title %&gt;
473
- end
474
- end
475
-
476
- </pre>
477
- </div>
478
- <p>You can do this:</p>
479
- <div class="code_container">
480
- <pre class="brush: ruby; gutter: false; toolbar: false">
481
- content_tag_for(:li, @items) do |item|
482
- Title: &lt;%= item.title %&gt;
483
- end
484
-
485
- </pre>
486
- </div>
487
- </li>
488
- <li><p>Added <code>font_path</code> helper method that computes the path to a font asset in <code>public/fonts</code>.</p></li>
489
- </ul>
490
- <h5 id="action-view-deprecations">7.3.1 Deprecations</h5>
491
- <ul>
492
- <li>Passing formats or handlers to render :template and friends like <code>render :template =&gt; "foo.html.erb"</code> is deprecated. Instead, you can provide :handlers and :formats directly as options: <code>render :template =&gt; "foo", :formats =&gt; [:html, :js], :handlers =&gt; :erb</code>.</li>
493
- </ul>
494
- <h4 id="sprockets">7.4 Sprockets</h4>
495
- <ul>
496
- <li>Adds a configuration option <code>config.assets.logger</code> to control Sprockets logging. Set it to <code>false</code> to turn off logging and to <code>nil</code> to default to <code>Rails.logger</code>.</li>
497
- </ul>
498
- <h3 id="active-record">8 Active Record</h3>
499
- <ul>
500
- <li><p>Boolean columns with 'on' and 'ON' values are type cast to true.</p></li>
501
- <li><p>When the <code>timestamps</code> method creates the <code>created_at</code> and <code>updated_at</code> columns, it makes them non-nullable by default.</p></li>
502
- <li><p>Implemented <code>ActiveRecord::Relation#explain</code>.</p></li>
503
- <li><p>Implements <code>AR::Base.silence_auto_explain</code> which allows the user to selectively disable automatic EXPLAINs within a block.</p></li>
504
- <li><p>Implements automatic EXPLAIN logging for slow queries. A new configuration parameter <code>config.active_record.auto_explain_threshold_in_seconds</code> determines what's to be considered a slow query. Setting that to nil disables this feature. Defaults are 0.5 in development mode, and nil in test and production modes. Rails 3.2 supports this feature in SQLite, MySQL (mysql2 adapter), and PostgreSQL.</p></li>
505
- <li>
506
- <p>Added <code>ActiveRecord::Base.store</code> for declaring simple single-column key/value stores.</p>
507
- <div class="code_container">
508
- <pre class="brush: ruby; gutter: false; toolbar: false">
509
- class User &lt; ActiveRecord::Base
510
- store :settings, accessors: [ :color, :homepage ]
511
- end
512
-
513
- u = User.new(color: 'black', homepage: '37signals.com')
514
- u.color # Accessor stored attribute
515
- u.settings[:country] = 'Denmark' # Any attribute, even if not specified with an accessor
516
-
517
- </pre>
518
- </div>
519
- </li>
520
- <li>
521
- <p>Added ability to run migrations only for a given scope, which allows to run migrations only from one engine (for example to revert changes from an engine that need to be removed).</p>
522
- <div class="code_container">
523
- <pre class="brush: plain; gutter: false; toolbar: false">
524
- rake db:migrate SCOPE=blog
525
-
526
- </pre>
527
- </div>
528
- </li>
529
- <li><p>Migrations copied from engines are now scoped with engine's name, for example <code>01_create_posts.blog.rb</code>.</p></li>
530
- <li>
531
- <p>Implemented <code>ActiveRecord::Relation#pluck</code> method that returns an array of column values directly from the underlying table. This also works with serialized attributes.</p>
532
- <div class="code_container">
533
- <pre class="brush: ruby; gutter: false; toolbar: false">
534
- Client.where(:active =&gt; true).pluck(:id)
535
- # SELECT id from clients where active = 1
536
-
537
- </pre>
538
- </div>
539
- </li>
540
- <li><p>Generated association methods are created within a separate module to allow overriding and composition. For a class named MyModel, the module is named <code>MyModel::GeneratedFeatureMethods</code>. It is included into the model class immediately after the <code>generated_attributes_methods</code> module defined in Active Model, so association methods override attribute methods of the same name.</p></li>
541
- <li>
542
- <p>Add <code>ActiveRecord::Relation#uniq</code> for generating unique queries.</p>
543
- <div class="code_container">
544
- <pre class="brush: ruby; gutter: false; toolbar: false">
545
- Client.select('DISTINCT name')
546
-
547
- </pre>
548
- </div>
549
- <p>..can be written as:</p>
550
- <div class="code_container">
551
- <pre class="brush: ruby; gutter: false; toolbar: false">
552
- Client.select(:name).uniq
553
-
554
- </pre>
555
- </div>
556
- <p>This also allows you to revert the uniqueness in a relation:</p>
557
- <div class="code_container">
558
- <pre class="brush: ruby; gutter: false; toolbar: false">
559
- Client.select(:name).uniq.uniq(false)
560
-
561
- </pre>
562
- </div>
563
- </li>
564
- <li><p>Support index sort order in SQLite, MySQL and PostgreSQL adapters.</p></li>
565
- <li>
566
- <p>Allow the <code>:class_name</code> option for associations to take a symbol in addition to a string. This is to avoid confusing newbies, and to be consistent with the fact that other options like <code>:foreign_key</code> already allow a symbol or a string.</p>
567
- <div class="code_container">
568
- <pre class="brush: ruby; gutter: false; toolbar: false">
569
- has_many :clients, :class_name =&gt; :Client # Note that the symbol need to be capitalized
570
-
571
- </pre>
572
- </div>
573
- </li>
574
- <li><p>In development mode, <code>db:drop</code> also drops the test database in order to be symmetric with <code>db:create</code>.</p></li>
575
- <li><p>Case-insensitive uniqueness validation avoids calling LOWER in MySQL when the column already uses a case-insensitive collation.</p></li>
576
- <li><p>Transactional fixtures enlist all active database connections. You can test models on different connections without disabling transactional fixtures.</p></li>
577
- <li>
578
- <p>Add <code>first_or_create</code>, <code>first_or_create!</code>, <code>first_or_initialize</code> methods to Active Record. This is a better approach over the old <code>find_or_create_by</code> dynamic methods because it's clearer which arguments are used to find the record and which are used to create it.</p>
579
- <div class="code_container">
580
- <pre class="brush: ruby; gutter: false; toolbar: false">
581
- User.where(:first_name =&gt; "Scarlett").first_or_create!(:last_name =&gt; "Johansson")
582
-
583
- </pre>
584
- </div>
585
- </li>
586
- <li>
587
- <p>Added a <code>with_lock</code> method to Active Record objects, which starts a transaction, locks the object (pessimistically) and yields to the block. The method takes one (optional) parameter and passes it to <code>lock!</code>.</p>
588
- <p>This makes it possible to write the following:</p>
589
- <div class="code_container">
590
- <pre class="brush: ruby; gutter: false; toolbar: false">
591
- class Order &lt; ActiveRecord::Base
592
- def cancel!
593
- transaction do
594
- lock!
595
- # ... cancelling logic
596
- end
597
- end
598
- end
599
-
600
- </pre>
601
- </div>
602
- <p>as:</p>
603
- <div class="code_container">
604
- <pre class="brush: ruby; gutter: false; toolbar: false">
605
- class Order &lt; ActiveRecord::Base
606
- def cancel!
607
- with_lock do
608
- # ... cancelling logic
609
- end
610
- end
611
- end
612
-
613
- </pre>
614
- </div>
615
- </li>
616
- </ul>
617
- <h4 id="active-record-deprecations">8.1 Deprecations</h4>
618
- <ul>
619
- <li>
620
- <p>Automatic closure of connections in threads is deprecated. For example the following code is deprecated:</p>
621
- <div class="code_container">
622
- <pre class="brush: ruby; gutter: false; toolbar: false">
623
- Thread.new { Post.find(1) }.join
624
-
625
- </pre>
626
- </div>
627
- <p>It should be changed to close the database connection at the end of the thread:</p>
628
- <div class="code_container">
629
- <pre class="brush: ruby; gutter: false; toolbar: false">
630
- Thread.new {
631
- Post.find(1)
632
- Post.connection.close
633
- }.join
634
-
635
- </pre>
636
- </div>
637
- <p>Only people who spawn threads in their application code need to worry about this change.</p>
638
- </li>
639
- <li>
640
- <p>The <code>set_table_name</code>, <code>set_inheritance_column</code>, <code>set_sequence_name</code>, <code>set_primary_key</code>, <code>set_locking_column</code> methods are deprecated. Use an assignment method instead. For example, instead of <code>set_table_name</code>, use <code>self.table_name=</code>.</p>
641
- <div class="code_container">
642
- <pre class="brush: ruby; gutter: false; toolbar: false">
643
- class Project &lt; ActiveRecord::Base
644
- self.table_name = "project"
645
- end
646
-
647
- </pre>
648
- </div>
649
- <p>Or define your own <code>self.table_name</code> method:</p>
650
- <div class="code_container">
651
- <pre class="brush: ruby; gutter: false; toolbar: false">
652
- class Post &lt; ActiveRecord::Base
653
- def self.table_name
654
- "special_" + super
655
- end
656
- end
657
-
658
- Post.table_name # =&gt; "special_posts"
659
-
660
-
661
- </pre>
662
- </div>
663
- </li>
664
- </ul>
665
- <h3 id="active-model">9 Active Model</h3>
666
- <ul>
667
- <li><p>Add <code>ActiveModel::Errors#added?</code> to check if a specific error has been added.</p></li>
668
- <li><p>Add ability to define strict validations with <code>strict =&gt; true</code> that always raises exception when fails.</p></li>
669
- <li><p>Provide mass_assignment_sanitizer as an easy API to replace the sanitizer behavior. Also support both :logger (default) and :strict sanitizer behavior.</p></li>
670
- </ul>
671
- <h4 id="active-model-deprecations">9.1 Deprecations</h4>
672
- <ul>
673
- <li><p>Deprecated <code>define_attr_method</code> in <code>ActiveModel::AttributeMethods</code> because this only existed to support methods like <code>set_table_name</code> in Active Record, which are themselves being deprecated.</p></li>
674
- <li><p>Deprecated <code>Model.model_name.partial_path</code> in favor of <code>model.to_partial_path</code>.</p></li>
675
- </ul>
676
- <h3 id="active-resource">10 Active Resource</h3>
677
- <ul>
678
- <li>Redirect responses: 303 See Other and 307 Temporary Redirect now behave like 301 Moved Permanently and 302 Found.</li>
679
- </ul>
680
- <h3 id="active-support">11 Active Support</h3>
681
- <ul>
682
- <li>
683
- <p>Added <code>ActiveSupport:TaggedLogging</code> that can wrap any standard <code>Logger</code> class to provide tagging capabilities.</p>
684
- <div class="code_container">
685
- <pre class="brush: ruby; gutter: false; toolbar: false">
686
- Logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
687
-
688
- Logger.tagged("BCX") { Logger.info "Stuff" }
689
- # Logs "[BCX] Stuff"
690
-
691
- Logger.tagged("BCX", "Jason") { Logger.info "Stuff" }
692
- # Logs "[BCX] [Jason] Stuff"
693
-
694
- Logger.tagged("BCX") { Logger.tagged("Jason") { Logger.info "Stuff" } }
695
- # Logs "[BCX] [Jason] Stuff"
696
-
697
- </pre>
698
- </div>
699
- </li>
700
- <li><p>The <code>beginning_of_week</code> method in <code>Date</code>, <code>Time</code> and <code>DateTime</code> accepts an optional argument representing the day in which the week is assumed to start.</p></li>
701
- <li><p><code>ActiveSupport::Notifications.subscribed</code> provides subscriptions to events while a block runs.</p></li>
702
- <li><p>Defined new methods <code>Module#qualified_const_defined?</code>, <code>Module#qualified_const_get</code> and <code>Module#qualified_const_set</code> that are analogous to the corresponding methods in the standard API, but accept qualified constant names.</p></li>
703
- <li><p>Added <code>#deconstantize</code> which complements <code>#demodulize</code> in inflections. This removes the rightmost segment in a qualified constant name.</p></li>
704
- <li><p>Added <code>safe_constantize</code> that constantizes a string but returns <code>nil</code> instead of raising an exception if the constant (or part of it) does not exist.</p></li>
705
- <li><p><code>ActiveSupport::OrderedHash</code> is now marked as extractable when using <code>Array#extract_options!</code>.</p></li>
706
- <li><p>Added <code>Array#prepend</code> as an alias for <code>Array#unshift</code> and <code>Array#append</code> as an alias for <code>Array#&lt;&lt;</code>.</p></li>
707
- <li><p>The definition of a blank string for Ruby 1.9 has been extended to Unicode whitespace. Also, in Ruby 1.8 the ideographic space U`3000 is considered to be whitespace.</p></li>
708
- <li><p>The inflector understands acronyms.</p></li>
709
- <li>
710
- <p>Added <code>Time#all_day</code>, <code>Time#all_week</code>, <code>Time#all_quarter</code> and <code>Time#all_year</code> as a way of generating ranges.</p>
711
- <div class="code_container">
712
- <pre class="brush: ruby; gutter: false; toolbar: false">
713
- Event.where(:created_at =&gt; Time.now.all_week)
714
- Event.where(:created_at =&gt; Time.now.all_day)
715
-
716
- </pre>
717
- </div>
718
- </li>
719
- <li><p>Added <code>instance_accessor: false</code> as an option to <code>Class#cattr_accessor</code> and friends.</p></li>
720
- <li><p><code>ActiveSupport::OrderedHash</code> now has different behavior for <code>#each</code> and <code>#each_pair</code> when given a block accepting its parameters with a splat.</p></li>
721
- <li><p>Added <code>ActiveSupport::Cache::NullStore</code> for use in development and testing.</p></li>
722
- <li><p>Removed <code>ActiveSupport::SecureRandom</code> in favor of <code>SecureRandom</code> from the standard library.</p></li>
723
- </ul>
724
- <h4 id="deprecations">11.1 Deprecations</h4>
725
- <ul>
726
- <li><p><code>ActiveSupport::Base64</code> is deprecated in favor of <code>::Base64</code>.</p></li>
727
- <li><p>Deprecated <code>ActiveSupport::Memoizable</code> in favor of Ruby memoization pattern.</p></li>
728
- <li><p><code>Module#synchronize</code> is deprecated with no replacement. Please use monitor from ruby's standard library.</p></li>
729
- <li><p>Deprecated <code>ActiveSupport::MessageEncryptor#encrypt</code> and <code>ActiveSupport::MessageEncryptor#decrypt</code>.</p></li>
730
- <li><p><code>ActiveSupport::BufferedLogger#silence</code> is deprecated. If you want to squelch logs for a certain block, change the log level for that block.</p></li>
731
- <li><p><code>ActiveSupport::BufferedLogger#open_log</code> is deprecated. This method should not have been public in the first place.</p></li>
732
- <li><p><code>ActiveSupport::BufferedLogger's</code> behavior of automatically creating the directory for your log file is deprecated. Please make sure to create the directory for your log file before instantiating.</p></li>
733
- <li>
734
- <p><code>ActiveSupport::BufferedLogger#auto_flushing</code> is deprecated. Either set the sync level on the underlying file handle like this. Or tune your filesystem. The FS cache is now what controls flushing.</p>
735
- <div class="code_container">
736
- <pre class="brush: ruby; gutter: false; toolbar: false">
737
- f = File.open('foo.log', 'w')
738
- f.sync = true
739
- ActiveSupport::BufferedLogger.new f
740
-
741
- </pre>
742
- </div>
743
- </li>
744
- <li><p><code>ActiveSupport::BufferedLogger#flush</code> is deprecated. Set sync on your filehandle, or tune your filesystem.</p></li>
745
- </ul>
746
- <h3 id="credits">12 Credits</h3><p>See the <a href="http://contributors.rubyonrails.org/">full list of contributors to Rails</a> for the many people who spent many hours making Rails, the stable and robust framework it is. Kudos to all of them.</p><p>Rails 3.2 Release Notes were compiled by <a href="https://github.com/vijaydev">Vijay Dev</a>.</p>
747
-
748
- <h3>Feedback</h3>
749
- <p>
750
- You're encouraged to help improve the quality of this guide.
751
- </p>
752
- <p>
753
- Please contribute if you see any typos or factual errors.
754
- 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.
755
- </p>
756
- <p>
757
- You may also find incomplete content, or stuff that is not up to date.
758
- Please do add any missing documentation for master. Make sure to check
759
- <a href="http://edgeguides.rubyonrails.org">Edge Guides</a> first to verify
760
- if the issues are already fixed or not on the master branch.
761
- Check the <a href="ruby_on_rails_guides_guidelines.html">Ruby on Rails Guides Guidelines</a>
762
- for style and conventions.
763
- </p>
764
- <p>
765
- If for whatever reason you spot something to fix but cannot patch it yourself, please
766
- <a href="https://github.com/rails/rails/issues">open an issue</a>.
767
- </p>
768
- <p>And last but not least, any kind of discussion regarding Ruby on Rails
769
- documentation is very welcome in the <a href="http://groups.google.com/group/rubyonrails-docs">rubyonrails-docs mailing list</a>.
770
- </p>
771
- </div>
772
- </div>
773
- </div>
774
-
775
- <hr class="hide" />
776
- <div id="footer">
777
- <div class="wrapper">
778
- <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>
779
- <p>"Rails", "Ruby on Rails", and the Rails logo are trademarks of David Heinemeier Hansson. All rights reserved.</p>
780
-
781
- </div>
782
- </div>
783
-
784
- <script type="text/javascript" src="javascripts/jquery.min.js"></script>
785
- <script type="text/javascript" src="javascripts/responsive-tables.js"></script>
786
- <script type="text/javascript" src="javascripts/guides.js"></script>
787
- <script type="text/javascript" src="javascripts/syntaxhighlighter/shCore.js"></script>
788
- <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushRuby.js"></script>
789
- <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushXml.js"></script>
790
- <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushSql.js"></script>
791
- <script type="text/javascript" src="javascripts/syntaxhighlighter/shBrushPlain.js"></script>
792
- <script type="text/javascript">
793
- SyntaxHighlighter.all();
794
- $(guidesIndex.bind);
795
- </script>
796
- </body>
797
- </html>