rails 4.2.11.3 → 5.0.0.beta1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (218) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +11 -7
  3. metadata +38 -237
  4. data/guides/CHANGELOG.md +0 -113
  5. data/guides/Rakefile +0 -92
  6. data/guides/assets/images/akshaysurve.jpg +0 -0
  7. data/guides/assets/images/belongs_to.png +0 -0
  8. data/guides/assets/images/book_icon.gif +0 -0
  9. data/guides/assets/images/bullet.gif +0 -0
  10. data/guides/assets/images/chapters_icon.gif +0 -0
  11. data/guides/assets/images/check_bullet.gif +0 -0
  12. data/guides/assets/images/credits_pic_blank.gif +0 -0
  13. data/guides/assets/images/csrf.png +0 -0
  14. data/guides/assets/images/edge_badge.png +0 -0
  15. data/guides/assets/images/favicon.ico +0 -0
  16. data/guides/assets/images/feature_tile.gif +0 -0
  17. data/guides/assets/images/footer_tile.gif +0 -0
  18. data/guides/assets/images/fxn.png +0 -0
  19. data/guides/assets/images/getting_started/article_with_comments.png +0 -0
  20. data/guides/assets/images/getting_started/challenge.png +0 -0
  21. data/guides/assets/images/getting_started/confirm_dialog.png +0 -0
  22. data/guides/assets/images/getting_started/forbidden_attributes_for_new_article.png +0 -0
  23. data/guides/assets/images/getting_started/form_with_errors.png +0 -0
  24. data/guides/assets/images/getting_started/index_action_with_edit_link.png +0 -0
  25. data/guides/assets/images/getting_started/new_article.png +0 -0
  26. data/guides/assets/images/getting_started/rails_welcome.png +0 -0
  27. data/guides/assets/images/getting_started/routing_error_no_controller.png +0 -0
  28. data/guides/assets/images/getting_started/routing_error_no_route_matches.png +0 -0
  29. data/guides/assets/images/getting_started/show_action_for_articles.png +0 -0
  30. data/guides/assets/images/getting_started/template_is_missing_articles_new.png +0 -0
  31. data/guides/assets/images/getting_started/unknown_action_create_for_articles.png +0 -0
  32. data/guides/assets/images/getting_started/unknown_action_new_for_articles.png +0 -0
  33. data/guides/assets/images/grey_bullet.gif +0 -0
  34. data/guides/assets/images/habtm.png +0 -0
  35. data/guides/assets/images/has_many.png +0 -0
  36. data/guides/assets/images/has_many_through.png +0 -0
  37. data/guides/assets/images/has_one.png +0 -0
  38. data/guides/assets/images/has_one_through.png +0 -0
  39. data/guides/assets/images/header_backdrop.png +0 -0
  40. data/guides/assets/images/header_tile.gif +0 -0
  41. data/guides/assets/images/i18n/demo_html_safe.png +0 -0
  42. data/guides/assets/images/i18n/demo_localized_pirate.png +0 -0
  43. data/guides/assets/images/i18n/demo_translated_en.png +0 -0
  44. data/guides/assets/images/i18n/demo_translated_pirate.png +0 -0
  45. data/guides/assets/images/i18n/demo_translation_missing.png +0 -0
  46. data/guides/assets/images/i18n/demo_untranslated.png +0 -0
  47. data/guides/assets/images/icons/README +0 -5
  48. data/guides/assets/images/icons/callouts/1.png +0 -0
  49. data/guides/assets/images/icons/callouts/10.png +0 -0
  50. data/guides/assets/images/icons/callouts/11.png +0 -0
  51. data/guides/assets/images/icons/callouts/12.png +0 -0
  52. data/guides/assets/images/icons/callouts/13.png +0 -0
  53. data/guides/assets/images/icons/callouts/14.png +0 -0
  54. data/guides/assets/images/icons/callouts/15.png +0 -0
  55. data/guides/assets/images/icons/callouts/2.png +0 -0
  56. data/guides/assets/images/icons/callouts/3.png +0 -0
  57. data/guides/assets/images/icons/callouts/4.png +0 -0
  58. data/guides/assets/images/icons/callouts/5.png +0 -0
  59. data/guides/assets/images/icons/callouts/6.png +0 -0
  60. data/guides/assets/images/icons/callouts/7.png +0 -0
  61. data/guides/assets/images/icons/callouts/8.png +0 -0
  62. data/guides/assets/images/icons/callouts/9.png +0 -0
  63. data/guides/assets/images/icons/caution.png +0 -0
  64. data/guides/assets/images/icons/example.png +0 -0
  65. data/guides/assets/images/icons/home.png +0 -0
  66. data/guides/assets/images/icons/important.png +0 -0
  67. data/guides/assets/images/icons/next.png +0 -0
  68. data/guides/assets/images/icons/note.png +0 -0
  69. data/guides/assets/images/icons/prev.png +0 -0
  70. data/guides/assets/images/icons/tip.png +0 -0
  71. data/guides/assets/images/icons/up.png +0 -0
  72. data/guides/assets/images/icons/warning.png +0 -0
  73. data/guides/assets/images/nav_arrow.gif +0 -0
  74. data/guides/assets/images/oscardelben.jpg +0 -0
  75. data/guides/assets/images/polymorphic.png +0 -0
  76. data/guides/assets/images/radar.png +0 -0
  77. data/guides/assets/images/rails4_features.png +0 -0
  78. data/guides/assets/images/rails_guides_kindle_cover.jpg +0 -0
  79. data/guides/assets/images/rails_guides_logo.gif +0 -0
  80. data/guides/assets/images/rails_logo_remix.gif +0 -0
  81. data/guides/assets/images/session_fixation.png +0 -0
  82. data/guides/assets/images/tab_grey.gif +0 -0
  83. data/guides/assets/images/tab_info.gif +0 -0
  84. data/guides/assets/images/tab_note.gif +0 -0
  85. data/guides/assets/images/tab_red.gif +0 -0
  86. data/guides/assets/images/tab_yellow.gif +0 -0
  87. data/guides/assets/images/tab_yellow.png +0 -0
  88. data/guides/assets/images/vijaydev.jpg +0 -0
  89. data/guides/assets/javascripts/guides.js +0 -59
  90. data/guides/assets/javascripts/jquery.min.js +0 -4
  91. data/guides/assets/javascripts/responsive-tables.js +0 -43
  92. data/guides/assets/javascripts/syntaxhighlighter/shBrushAS3.js +0 -59
  93. data/guides/assets/javascripts/syntaxhighlighter/shBrushAppleScript.js +0 -75
  94. data/guides/assets/javascripts/syntaxhighlighter/shBrushBash.js +0 -59
  95. data/guides/assets/javascripts/syntaxhighlighter/shBrushCSharp.js +0 -65
  96. data/guides/assets/javascripts/syntaxhighlighter/shBrushColdFusion.js +0 -100
  97. data/guides/assets/javascripts/syntaxhighlighter/shBrushCpp.js +0 -97
  98. data/guides/assets/javascripts/syntaxhighlighter/shBrushCss.js +0 -91
  99. data/guides/assets/javascripts/syntaxhighlighter/shBrushDelphi.js +0 -55
  100. data/guides/assets/javascripts/syntaxhighlighter/shBrushDiff.js +0 -41
  101. data/guides/assets/javascripts/syntaxhighlighter/shBrushErlang.js +0 -52
  102. data/guides/assets/javascripts/syntaxhighlighter/shBrushGroovy.js +0 -67
  103. data/guides/assets/javascripts/syntaxhighlighter/shBrushJScript.js +0 -52
  104. data/guides/assets/javascripts/syntaxhighlighter/shBrushJava.js +0 -57
  105. data/guides/assets/javascripts/syntaxhighlighter/shBrushJavaFX.js +0 -58
  106. data/guides/assets/javascripts/syntaxhighlighter/shBrushPerl.js +0 -72
  107. data/guides/assets/javascripts/syntaxhighlighter/shBrushPhp.js +0 -88
  108. data/guides/assets/javascripts/syntaxhighlighter/shBrushPlain.js +0 -33
  109. data/guides/assets/javascripts/syntaxhighlighter/shBrushPowerShell.js +0 -74
  110. data/guides/assets/javascripts/syntaxhighlighter/shBrushPython.js +0 -64
  111. data/guides/assets/javascripts/syntaxhighlighter/shBrushRuby.js +0 -55
  112. data/guides/assets/javascripts/syntaxhighlighter/shBrushSass.js +0 -94
  113. data/guides/assets/javascripts/syntaxhighlighter/shBrushScala.js +0 -51
  114. data/guides/assets/javascripts/syntaxhighlighter/shBrushSql.js +0 -66
  115. data/guides/assets/javascripts/syntaxhighlighter/shBrushVb.js +0 -56
  116. data/guides/assets/javascripts/syntaxhighlighter/shBrushXml.js +0 -69
  117. data/guides/assets/javascripts/syntaxhighlighter/shCore.js +0 -17
  118. data/guides/assets/stylesheets/fixes.css +0 -16
  119. data/guides/assets/stylesheets/kindle.css +0 -11
  120. data/guides/assets/stylesheets/main.css +0 -713
  121. data/guides/assets/stylesheets/print.css +0 -52
  122. data/guides/assets/stylesheets/reset.css +0 -43
  123. data/guides/assets/stylesheets/responsive-tables.css +0 -50
  124. data/guides/assets/stylesheets/style.css +0 -13
  125. data/guides/assets/stylesheets/syntaxhighlighter/shCore.css +0 -226
  126. data/guides/assets/stylesheets/syntaxhighlighter/shCoreDefault.css +0 -328
  127. data/guides/assets/stylesheets/syntaxhighlighter/shCoreDjango.css +0 -331
  128. data/guides/assets/stylesheets/syntaxhighlighter/shCoreEclipse.css +0 -339
  129. data/guides/assets/stylesheets/syntaxhighlighter/shCoreEmacs.css +0 -324
  130. data/guides/assets/stylesheets/syntaxhighlighter/shCoreFadeToGrey.css +0 -328
  131. data/guides/assets/stylesheets/syntaxhighlighter/shCoreMDUltra.css +0 -324
  132. data/guides/assets/stylesheets/syntaxhighlighter/shCoreMidnight.css +0 -324
  133. data/guides/assets/stylesheets/syntaxhighlighter/shCoreRDark.css +0 -324
  134. data/guides/assets/stylesheets/syntaxhighlighter/shThemeDefault.css +0 -117
  135. data/guides/assets/stylesheets/syntaxhighlighter/shThemeDjango.css +0 -120
  136. data/guides/assets/stylesheets/syntaxhighlighter/shThemeEclipse.css +0 -128
  137. data/guides/assets/stylesheets/syntaxhighlighter/shThemeEmacs.css +0 -113
  138. data/guides/assets/stylesheets/syntaxhighlighter/shThemeFadeToGrey.css +0 -117
  139. data/guides/assets/stylesheets/syntaxhighlighter/shThemeMDUltra.css +0 -113
  140. data/guides/assets/stylesheets/syntaxhighlighter/shThemeMidnight.css +0 -113
  141. data/guides/assets/stylesheets/syntaxhighlighter/shThemeRDark.css +0 -113
  142. data/guides/assets/stylesheets/syntaxhighlighter/shThemeRailsGuides.css +0 -116
  143. data/guides/bug_report_templates/action_controller_gem.rb +0 -47
  144. data/guides/bug_report_templates/action_controller_master.rb +0 -54
  145. data/guides/bug_report_templates/active_record_gem.rb +0 -40
  146. data/guides/bug_report_templates/active_record_master.rb +0 -49
  147. data/guides/bug_report_templates/generic_gem.rb +0 -15
  148. data/guides/bug_report_templates/generic_master.rb +0 -26
  149. data/guides/rails_guides.rb +0 -63
  150. data/guides/rails_guides/generator.rb +0 -248
  151. data/guides/rails_guides/helpers.rb +0 -53
  152. data/guides/rails_guides/indexer.rb +0 -68
  153. data/guides/rails_guides/kindle.rb +0 -119
  154. data/guides/rails_guides/levenshtein.rb +0 -37
  155. data/guides/rails_guides/markdown.rb +0 -167
  156. data/guides/rails_guides/markdown/renderer.rb +0 -82
  157. data/guides/source/2_2_release_notes.md +0 -435
  158. data/guides/source/2_3_release_notes.md +0 -621
  159. data/guides/source/3_0_release_notes.md +0 -611
  160. data/guides/source/3_1_release_notes.md +0 -559
  161. data/guides/source/3_2_release_notes.md +0 -568
  162. data/guides/source/4_0_release_notes.md +0 -279
  163. data/guides/source/4_1_release_notes.md +0 -730
  164. data/guides/source/4_2_release_notes.md +0 -877
  165. data/guides/source/_license.html.erb +0 -2
  166. data/guides/source/_welcome.html.erb +0 -23
  167. data/guides/source/action_controller_overview.md +0 -1192
  168. data/guides/source/action_mailer_basics.md +0 -757
  169. data/guides/source/action_view_overview.md +0 -1561
  170. data/guides/source/active_job_basics.md +0 -339
  171. data/guides/source/active_model_basics.md +0 -554
  172. data/guides/source/active_record_basics.md +0 -374
  173. data/guides/source/active_record_callbacks.md +0 -413
  174. data/guides/source/active_record_migrations.md +0 -1018
  175. data/guides/source/active_record_postgresql.md +0 -433
  176. data/guides/source/active_record_querying.md +0 -1781
  177. data/guides/source/active_record_validations.md +0 -1179
  178. data/guides/source/active_support_core_extensions.md +0 -3856
  179. data/guides/source/active_support_instrumentation.md +0 -488
  180. data/guides/source/api_documentation_guidelines.md +0 -361
  181. data/guides/source/asset_pipeline.md +0 -1304
  182. data/guides/source/association_basics.md +0 -2245
  183. data/guides/source/autoloading_and_reloading_constants.md +0 -1311
  184. data/guides/source/caching_with_rails.md +0 -379
  185. data/guides/source/command_line.md +0 -625
  186. data/guides/source/configuring.md +0 -1070
  187. data/guides/source/contributing_to_ruby_on_rails.md +0 -628
  188. data/guides/source/credits.html.erb +0 -80
  189. data/guides/source/debugging_rails_applications.md +0 -861
  190. data/guides/source/development_dependencies_install.md +0 -289
  191. data/guides/source/documents.yaml +0 -205
  192. data/guides/source/engines.md +0 -1412
  193. data/guides/source/form_helpers.md +0 -1024
  194. data/guides/source/generators.md +0 -676
  195. data/guides/source/getting_started.md +0 -2086
  196. data/guides/source/i18n.md +0 -1087
  197. data/guides/source/index.html.erb +0 -28
  198. data/guides/source/initialization.md +0 -704
  199. data/guides/source/kindle/copyright.html.erb +0 -1
  200. data/guides/source/kindle/layout.html.erb +0 -27
  201. data/guides/source/kindle/rails_guides.opf.erb +0 -52
  202. data/guides/source/kindle/toc.html.erb +0 -24
  203. data/guides/source/kindle/toc.ncx.erb +0 -64
  204. data/guides/source/kindle/welcome.html.erb +0 -5
  205. data/guides/source/layout.html.erb +0 -140
  206. data/guides/source/layouts_and_rendering.md +0 -1226
  207. data/guides/source/maintenance_policy.md +0 -78
  208. data/guides/source/nested_model_forms.md +0 -228
  209. data/guides/source/plugins.md +0 -444
  210. data/guides/source/rails_application_templates.md +0 -266
  211. data/guides/source/rails_on_rack.md +0 -335
  212. data/guides/source/routing.md +0 -1155
  213. data/guides/source/ruby_on_rails_guides_guidelines.md +0 -127
  214. data/guides/source/security.md +0 -1024
  215. data/guides/source/testing.md +0 -1132
  216. data/guides/source/upgrading_ruby_on_rails.md +0 -1186
  217. data/guides/source/working_with_javascript_in_rails.md +0 -407
  218. data/guides/w3c_validator.rb +0 -97
@@ -1,568 +0,0 @@
1
- Ruby on Rails 3.2 Release Notes
2
- ===============================
3
-
4
- Highlights in Rails 3.2:
5
-
6
- * Faster Development Mode
7
- * New Routing Engine
8
- * Automatic Query Explains
9
- * Tagged Logging
10
-
11
- These release notes cover only the major changes. To learn about various bug
12
- fixes and changes, please refer to the change logs or check out the [list of
13
- commits](https://github.com/rails/rails/commits/3-2-stable) in the main Rails
14
- repository on GitHub.
15
-
16
- --------------------------------------------------------------------------------
17
-
18
- Upgrading to Rails 3.2
19
- ----------------------
20
-
21
- 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:
22
-
23
- ### Rails 3.2 requires at least Ruby 1.8.7
24
-
25
- 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.
26
-
27
- TIP: 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.
28
-
29
- ### What to update in your apps
30
-
31
- * Update your Gemfile to depend on
32
- * `rails = 3.2.0`
33
- * `sass-rails ~> 3.2.3`
34
- * `coffee-rails ~> 3.2.1`
35
- * `uglifier >= 1.0.3`
36
-
37
- * Rails 3.2 deprecates `vendor/plugins` 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, `lib/my_plugin/*` and add an appropriate initializer in `config/initializers/my_plugin.rb`.
38
-
39
- * There are a couple of new configuration changes you'd want to add in `config/environments/development.rb`:
40
-
41
- ```ruby
42
- # Raise exception on mass assignment protection for Active Record models
43
- config.active_record.mass_assignment_sanitizer = :strict
44
-
45
- # Log the query plan for queries taking more than this (works
46
- # with SQLite, MySQL, and PostgreSQL)
47
- config.active_record.auto_explain_threshold_in_seconds = 0.5
48
- ```
49
-
50
- The `mass_assignment_sanitizer` config also needs to be added in `config/environments/test.rb`:
51
-
52
- ```ruby
53
- # Raise exception on mass assignment protection for Active Record models
54
- config.active_record.mass_assignment_sanitizer = :strict
55
- ```
56
-
57
- ### What to update in your engines
58
-
59
- Replace the code beneath the comment in `script/rails` with the following content:
60
-
61
- ```ruby
62
- ENGINE_ROOT = File.expand_path('../..', __FILE__)
63
- ENGINE_PATH = File.expand_path('../../lib/your_engine_name/engine', __FILE__)
64
-
65
- require 'rails/all'
66
- require 'rails/engine/commands'
67
- ```
68
-
69
- Creating a Rails 3.2 application
70
- --------------------------------
71
-
72
- ```bash
73
- # You should have the 'rails' RubyGem installed
74
- $ rails new myapp
75
- $ cd myapp
76
- ```
77
-
78
- ### Vendoring Gems
79
-
80
- Rails now uses a `Gemfile` in the application root to determine the gems you require for your application to start. This `Gemfile` is processed by the [Bundler](https://github.com/carlhuda/bundler) 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.
81
-
82
- More information: [Bundler homepage](http://gembundler.com)
83
-
84
- ### Living on the Edge
85
-
86
- `Bundler` and `Gemfile` makes freezing your Rails application easy as pie with the new dedicated `bundle` command. If you want to bundle straight from the Git repository, you can pass the `--edge` flag:
87
-
88
- ```bash
89
- $ rails new myapp --edge
90
- ```
91
-
92
- If you have a local checkout of the Rails repository and want to generate an application using that, you can pass the `--dev` flag:
93
-
94
- ```bash
95
- $ ruby /path/to/rails/railties/bin/rails new myapp --dev
96
- ```
97
-
98
- Major Features
99
- --------------
100
-
101
- ### Faster Development Mode & Routing
102
-
103
- Rails 3.2 comes with a development mode that's noticeably faster. Inspired by [Active Reload](https://github.com/paneq/active_reload), 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 [Journey](https://github.com/rails/journey) engine.
104
-
105
- ### Automatic Query Explains
106
-
107
- Rails 3.2 comes with a nice feature that explains queries generated by Arel by defining an `explain` method in `ActiveRecord::Relation`. For example, you can run something like `puts Person.active.limit(5).explain` and the query Arel produces is explained. This allows to check for the proper indexes and further optimizations.
108
-
109
- Queries that take more than half a second to run are *automatically* explained in the development mode. This threshold, of course, can be changed.
110
-
111
- ### Tagged Logging
112
-
113
- 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.
114
-
115
- Documentation
116
- -------------
117
-
118
- From Rails 3.2, the Rails guides are available for the Kindle and free Kindle Reading Apps for the iPad, iPhone, Mac, Android, etc.
119
-
120
- Railties
121
- --------
122
-
123
- * Speed up development by only reloading classes if dependencies files changed. This can be turned off by setting `config.reload_classes_only_on_change` to false.
124
-
125
- * New applications get a flag `config.active_record.auto_explain_threshold_in_seconds` in the environments configuration files. With a value of `0.5` in `development.rb` and commented out in `production.rb`. No mention in `test.rb`.
126
-
127
- * Added `config.exceptions_app` to set the exceptions application invoked by the `ShowException` middleware when an exception happens. Defaults to `ActionDispatch::PublicExceptions.new(Rails.public_path)`.
128
-
129
- * Added a `DebugExceptions` middleware which contains features extracted from `ShowExceptions` middleware.
130
-
131
- * Display mounted engines' routes in `rake routes`.
132
-
133
- * Allow to change the loading order of railties with `config.railties_order` like:
134
-
135
- ```ruby
136
- config.railties_order = [Blog::Engine, :main_app, :all]
137
- ```
138
-
139
- * Scaffold returns 204 No Content for API requests without content. This makes scaffold work with jQuery out of the box.
140
-
141
- * Update `Rails::Rack::Logger` middleware to apply any tags set in `config.log_tags` to `ActiveSupport::TaggedLogging`. 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.
142
-
143
- * Default options to `rails new` can be set in `~/.railsrc`. You can specify extra command-line arguments to be used every time `rails new` runs in the `.railsrc` configuration file in your home directory.
144
-
145
- * Add an alias `d` for `destroy`. This works for engines too.
146
-
147
- * Attributes on scaffold and model generators default to string. This allows the following: `rails g scaffold Post title body:text author`
148
-
149
- * Allow scaffold/model/migration generators to accept "index" and "uniq" modifiers. For example,
150
-
151
- ```ruby
152
- rails g scaffold Post title:string:index author:uniq price:decimal{7,2}
153
- ```
154
-
155
- will create indexes for `title` and `author` with the latter being an unique index. Some types such as decimal accept custom options. In the example, `price` will be a decimal column with precision and scale set to 7 and 2 respectively.
156
-
157
- * Turn gem has been removed from default Gemfile.
158
-
159
- * Remove old plugin generator `rails generate plugin` in favor of `rails plugin new` command.
160
-
161
- * Remove old `config.paths.app.controller` API in favor of `config.paths["app/controller"]`.
162
-
163
- #### Deprecations
164
-
165
- * `Rails::Plugin` is deprecated and will be removed in Rails 4.0. Instead of adding plugins to `vendor/plugins` use gems or bundler with path or git dependencies.
166
-
167
- Action Mailer
168
- -------------
169
-
170
- * Upgraded `mail` version to 2.4.0.
171
-
172
- * Removed the old Action Mailer API which was deprecated since Rails 3.0.
173
-
174
- Action Pack
175
- -----------
176
-
177
- ### Action Controller
178
-
179
- * Make `ActiveSupport::Benchmarkable` a default module for `ActionController::Base,` so the `#benchmark` method is once again available in the controller context like it used to be.
180
-
181
- * Added `:gzip` option to `caches_page`. The default option can be configured globally using `page_cache_compression`.
182
-
183
- * Rails will now use your default layout (such as "layouts/application") when you specify a layout with `:only` and `:except` condition, and those conditions fail.
184
-
185
- ```ruby
186
- class CarsController
187
- layout 'single_car', :only => :show
188
- end
189
- ```
190
-
191
- Rails will use `layouts/single_car` when a request comes in `:show` action, and use `layouts/application` (or `layouts/cars`, if exists) when a request comes in for any other actions.
192
-
193
- * `form_for` is changed to use `#{action}_#{as}` as the css class and id if `:as` option is provided. Earlier versions used `#{as}_#{action}`.
194
-
195
- * `ActionController::ParamsWrapper` on Active Record models now only wrap `attr_accessible` attributes if they were set. If not, only the attributes returned by the class method `attribute_names` will be wrapped. This fixes the wrapping of nested attributes by adding them to `attr_accessible`.
196
-
197
- * Log "Filter chain halted as CALLBACKNAME rendered or redirected" every time a before callback halts.
198
-
199
- * `ActionDispatch::ShowExceptions` is refactored. The controller is responsible for choosing to show exceptions. It's possible to override `show_detailed_exceptions?` in controllers to specify which requests should provide debugging information on errors.
200
-
201
- * Responders now return 204 No Content for API requests without a response body (as in the new scaffold).
202
-
203
- * `ActionController::TestCase` cookies is refactored. Assigning cookies for test cases should now use `cookies[]`
204
-
205
- ```ruby
206
- cookies[:email] = 'user@example.com'
207
- get :index
208
- assert_equal 'user@example.com', cookies[:email]
209
- ```
210
-
211
- To clear the cookies, use `clear`.
212
-
213
- ```ruby
214
- cookies.clear
215
- get :index
216
- assert_nil cookies[:email]
217
- ```
218
-
219
- 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.
220
-
221
- * `send_file` now guesses the MIME type from the file extension if `:type` is not provided.
222
-
223
- * MIME type entries for PDF, ZIP and other formats were added.
224
-
225
- * Allow `fresh_when/stale?` to take a record instead of an options hash.
226
-
227
- * Changed log level of warning for missing CSRF token from `:debug` to `:warn`.
228
-
229
- * Assets should use the request protocol by default or default to relative if no request is available.
230
-
231
- #### Deprecations
232
-
233
- * Deprecated implied layout lookup in controllers whose parent had an explicit layout set:
234
-
235
- ```ruby
236
- class ApplicationController
237
- layout "application"
238
- end
239
-
240
- class PostsController < ApplicationController
241
- end
242
- ```
243
-
244
- In the example above, `PostsController` will no longer automatically look up for a posts layout. If you need this functionality you could either remove `layout "application"` from `ApplicationController` or explicitly set it to `nil` in `PostsController`.
245
-
246
- * Deprecated `ActionController::UnknownAction` in favor of `AbstractController::ActionNotFound`.
247
-
248
- * Deprecated `ActionController::DoubleRenderError` in favor of `AbstractController::DoubleRenderError`.
249
-
250
- * Deprecated `method_missing` in favor of `action_missing` for missing actions.
251
-
252
- * Deprecated `ActionController#rescue_action`, `ActionController#initialize_template_class` and `ActionController#assign_shortcuts`.
253
-
254
- ### Action Dispatch
255
-
256
- * Add `config.action_dispatch.default_charset` to configure default charset for `ActionDispatch::Response`.
257
-
258
- * Added `ActionDispatch::RequestId` middleware that'll make a unique X-Request-Id header available to the response and enables the `ActionDispatch::Request#uuid` 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.
259
-
260
- * The `ShowExceptions` 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 `env["action_dispatch.exception"]` and with the `PATH_INFO` rewritten to the status code.
261
-
262
- * Allow rescue responses to be configured through a railtie as in `config.action_dispatch.rescue_responses`.
263
-
264
- #### Deprecations
265
-
266
- * Deprecated the ability to set a default charset at the controller level, use the new `config.action_dispatch.default_charset` instead.
267
-
268
- ### Action View
269
-
270
- * Add `button_tag` support to `ActionView::Helpers::FormBuilder`. This support mimics the default behavior of `submit_tag`.
271
-
272
- ```erb
273
- <%= form_for @post do |f| %>
274
- <%= f.button %>
275
- <% end %>
276
- ```
277
-
278
- * Date helpers accept a new option `:use_two_digit_numbers => true`, 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'.
279
-
280
- * 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.
281
-
282
- ```erb
283
- <%= form_for(@offer, :namespace => 'namespace') do |f| %>
284
- <%= f.label :version, 'Version' %>:
285
- <%= f.text_field :version %>
286
- <% end %>
287
- ```
288
-
289
- * Limit the number of options for `select_year` to 1000. Pass `:max_years_allowed` option to set your own limit.
290
-
291
- * `content_tag_for` and `div_for` 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:
292
-
293
- ```ruby
294
- @items.each do |item|
295
- content_tag_for(:li, item) do
296
- Title: <%= item.title %>
297
- end
298
- end
299
- ```
300
-
301
- You can do this:
302
-
303
- ```ruby
304
- content_tag_for(:li, @items) do |item|
305
- Title: <%= item.title %>
306
- end
307
- ```
308
-
309
- * Added `font_path` helper method that computes the path to a font asset in `public/fonts`.
310
-
311
- #### Deprecations
312
-
313
- * Passing formats or handlers to render :template and friends like `render :template => "foo.html.erb"` is deprecated. Instead, you can provide :handlers and :formats directly as options: ` render :template => "foo", :formats => [:html, :js], :handlers => :erb`.
314
-
315
- ### Sprockets
316
-
317
- * Adds a configuration option `config.assets.logger` to control Sprockets logging. Set it to `false` to turn off logging and to `nil` to default to `Rails.logger`.
318
-
319
- Active Record
320
- -------------
321
-
322
- * Boolean columns with 'on' and 'ON' values are type cast to true.
323
-
324
- * When the `timestamps` method creates the `created_at` and `updated_at` columns, it makes them non-nullable by default.
325
-
326
- * Implemented `ActiveRecord::Relation#explain`.
327
-
328
- * Implements `AR::Base.silence_auto_explain` which allows the user to selectively disable automatic EXPLAINs within a block.
329
-
330
- * Implements automatic EXPLAIN logging for slow queries. A new configuration parameter `config.active_record.auto_explain_threshold_in_seconds` 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.
331
-
332
- * Added `ActiveRecord::Base.store` for declaring simple single-column key/value stores.
333
-
334
- ```ruby
335
- class User < ActiveRecord::Base
336
- store :settings, accessors: [ :color, :homepage ]
337
- end
338
-
339
- u = User.new(color: 'black', homepage: '37signals.com')
340
- u.color # Accessor stored attribute
341
- u.settings[:country] = 'Denmark' # Any attribute, even if not specified with an accessor
342
- ```
343
-
344
- * 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).
345
-
346
- ```
347
- rake db:migrate SCOPE=blog
348
- ```
349
-
350
- * Migrations copied from engines are now scoped with engine's name, for example `01_create_posts.blog.rb`.
351
-
352
- * Implemented `ActiveRecord::Relation#pluck` method that returns an array of column values directly from the underlying table. This also works with serialized attributes.
353
-
354
- ```ruby
355
- Client.where(:active => true).pluck(:id)
356
- # SELECT id from clients where active = 1
357
- ```
358
-
359
- * Generated association methods are created within a separate module to allow overriding and composition. For a class named MyModel, the module is named `MyModel::GeneratedFeatureMethods`. It is included into the model class immediately after the `generated_attributes_methods` module defined in Active Model, so association methods override attribute methods of the same name.
360
-
361
- * Add `ActiveRecord::Relation#uniq` for generating unique queries.
362
-
363
- ```ruby
364
- Client.select('DISTINCT name')
365
- ```
366
-
367
- ..can be written as:
368
-
369
- ```ruby
370
- Client.select(:name).uniq
371
- ```
372
-
373
- This also allows you to revert the uniqueness in a relation:
374
-
375
- ```ruby
376
- Client.select(:name).uniq.uniq(false)
377
- ```
378
-
379
- * Support index sort order in SQLite, MySQL and PostgreSQL adapters.
380
-
381
- * Allow the `:class_name` 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 `:foreign_key` already allow a symbol or a string.
382
-
383
- ```ruby
384
- has_many :clients, :class_name => :Client # Note that the symbol need to be capitalized
385
- ```
386
-
387
- * In development mode, `db:drop` also drops the test database in order to be symmetric with `db:create`.
388
-
389
- * Case-insensitive uniqueness validation avoids calling LOWER in MySQL when the column already uses a case-insensitive collation.
390
-
391
- * Transactional fixtures enlist all active database connections. You can test models on different connections without disabling transactional fixtures.
392
-
393
- * Add `first_or_create`, `first_or_create!`, `first_or_initialize` methods to Active Record. This is a better approach over the old `find_or_create_by` dynamic methods because it's clearer which arguments are used to find the record and which are used to create it.
394
-
395
- ```ruby
396
- User.where(:first_name => "Scarlett").first_or_create!(:last_name => "Johansson")
397
- ```
398
-
399
- * Added a `with_lock` 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 `lock!`.
400
-
401
- This makes it possible to write the following:
402
-
403
- ```ruby
404
- class Order < ActiveRecord::Base
405
- def cancel!
406
- transaction do
407
- lock!
408
- # ... cancelling logic
409
- end
410
- end
411
- end
412
- ```
413
-
414
- as:
415
-
416
- ```ruby
417
- class Order < ActiveRecord::Base
418
- def cancel!
419
- with_lock do
420
- # ... cancelling logic
421
- end
422
- end
423
- end
424
- ```
425
-
426
- ### Deprecations
427
-
428
- * Automatic closure of connections in threads is deprecated. For example the following code is deprecated:
429
-
430
- ```ruby
431
- Thread.new { Post.find(1) }.join
432
- ```
433
-
434
- It should be changed to close the database connection at the end of the thread:
435
-
436
- ```ruby
437
- Thread.new {
438
- Post.find(1)
439
- Post.connection.close
440
- }.join
441
- ```
442
-
443
- Only people who spawn threads in their application code need to worry about this change.
444
-
445
- * The `set_table_name`, `set_inheritance_column`, `set_sequence_name`, `set_primary_key`, `set_locking_column` methods are deprecated. Use an assignment method instead. For example, instead of `set_table_name`, use `self.table_name=`.
446
-
447
- ```ruby
448
- class Project < ActiveRecord::Base
449
- self.table_name = "project"
450
- end
451
- ```
452
-
453
- Or define your own `self.table_name` method:
454
-
455
- ```ruby
456
- class Post < ActiveRecord::Base
457
- def self.table_name
458
- "special_" + super
459
- end
460
- end
461
-
462
- Post.table_name # => "special_posts"
463
-
464
- ```
465
-
466
- Active Model
467
- ------------
468
-
469
- * Add `ActiveModel::Errors#added?` to check if a specific error has been added.
470
-
471
- * Add ability to define strict validations with `strict => true` that always raises exception when fails.
472
-
473
- * Provide mass_assignment_sanitizer as an easy API to replace the sanitizer behavior. Also support both :logger (default) and :strict sanitizer behavior.
474
-
475
- ### Deprecations
476
-
477
- * Deprecated `define_attr_method` in `ActiveModel::AttributeMethods` because this only existed to support methods like `set_table_name` in Active Record, which are themselves being deprecated.
478
-
479
- * Deprecated `Model.model_name.partial_path` in favor of `model.to_partial_path`.
480
-
481
- Active Resource
482
- ---------------
483
-
484
- * Redirect responses: 303 See Other and 307 Temporary Redirect now behave like 301 Moved Permanently and 302 Found.
485
-
486
- Active Support
487
- --------------
488
-
489
- * Added `ActiveSupport:TaggedLogging` that can wrap any standard `Logger` class to provide tagging capabilities.
490
-
491
- ```ruby
492
- Logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))
493
-
494
- Logger.tagged("BCX") { Logger.info "Stuff" }
495
- # Logs "[BCX] Stuff"
496
-
497
- Logger.tagged("BCX", "Jason") { Logger.info "Stuff" }
498
- # Logs "[BCX] [Jason] Stuff"
499
-
500
- Logger.tagged("BCX") { Logger.tagged("Jason") { Logger.info "Stuff" } }
501
- # Logs "[BCX] [Jason] Stuff"
502
- ```
503
-
504
- * The `beginning_of_week` method in `Date`, `Time` and `DateTime` accepts an optional argument representing the day in which the week is assumed to start.
505
-
506
- * `ActiveSupport::Notifications.subscribed` provides subscriptions to events while a block runs.
507
-
508
- * Defined new methods `Module#qualified_const_defined?`, `Module#qualified_const_get` and `Module#qualified_const_set` that are analogous to the corresponding methods in the standard API, but accept qualified constant names.
509
-
510
- * Added `#deconstantize` which complements `#demodulize` in inflections. This removes the rightmost segment in a qualified constant name.
511
-
512
- * Added `safe_constantize` that constantizes a string but returns `nil` instead of raising an exception if the constant (or part of it) does not exist.
513
-
514
- * `ActiveSupport::OrderedHash` is now marked as extractable when using `Array#extract_options!`.
515
-
516
- * Added `Array#prepend` as an alias for `Array#unshift` and `Array#append` as an alias for `Array#<<`.
517
-
518
- * 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.
519
-
520
- * The inflector understands acronyms.
521
-
522
- * Added `Time#all_day`, `Time#all_week`, `Time#all_quarter` and `Time#all_year` as a way of generating ranges.
523
-
524
- ```ruby
525
- Event.where(:created_at => Time.now.all_week)
526
- Event.where(:created_at => Time.now.all_day)
527
- ```
528
-
529
- * Added `instance_accessor: false` as an option to `Class#cattr_accessor` and friends.
530
-
531
- * `ActiveSupport::OrderedHash` now has different behavior for `#each` and `#each_pair` when given a block accepting its parameters with a splat.
532
-
533
- * Added `ActiveSupport::Cache::NullStore` for use in development and testing.
534
-
535
- * Removed `ActiveSupport::SecureRandom` in favor of `SecureRandom` from the standard library.
536
-
537
- ### Deprecations
538
-
539
- * `ActiveSupport::Base64` is deprecated in favor of `::Base64`.
540
-
541
- * Deprecated `ActiveSupport::Memoizable` in favor of Ruby memoization pattern.
542
-
543
- * `Module#synchronize` is deprecated with no replacement. Please use monitor from ruby's standard library.
544
-
545
- * Deprecated `ActiveSupport::MessageEncryptor#encrypt` and `ActiveSupport::MessageEncryptor#decrypt`.
546
-
547
- * `ActiveSupport::BufferedLogger#silence` is deprecated. If you want to squelch logs for a certain block, change the log level for that block.
548
-
549
- * `ActiveSupport::BufferedLogger#open_log` is deprecated. This method should not have been public in the first place.
550
-
551
- * `ActiveSupport::BufferedLogger's` 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.
552
-
553
- * `ActiveSupport::BufferedLogger#auto_flushing` 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.
554
-
555
- ```ruby
556
- f = File.open('foo.log', 'w')
557
- f.sync = true
558
- ActiveSupport::BufferedLogger.new f
559
- ```
560
-
561
- * `ActiveSupport::BufferedLogger#flush` is deprecated. Set sync on your filehandle, or tune your filesystem.
562
-
563
- Credits
564
- -------
565
-
566
- See the [full list of contributors to Rails](http://contributors.rubyonrails.org/) for the many people who spent many hours making Rails, the stable and robust framework it is. Kudos to all of them.
567
-
568
- Rails 3.2 Release Notes were compiled by [Vijay Dev](https://github.com/vijaydev).