rails 4.2.11 → 5.2.8.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of rails might be problematic. Click here for more details.

Files changed (218) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +24 -12
  3. metadata +54 -248
  4. data/guides/CHANGELOG.md +0 -98
  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/generator.rb +0 -248
  150. data/guides/rails_guides/helpers.rb +0 -53
  151. data/guides/rails_guides/indexer.rb +0 -68
  152. data/guides/rails_guides/kindle.rb +0 -119
  153. data/guides/rails_guides/levenshtein.rb +0 -37
  154. data/guides/rails_guides/markdown/renderer.rb +0 -82
  155. data/guides/rails_guides/markdown.rb +0 -167
  156. data/guides/rails_guides.rb +0 -63
  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,559 +0,0 @@
1
- Ruby on Rails 3.1 Release Notes
2
- ===============================
3
-
4
- Highlights in Rails 3.1:
5
-
6
- * Streaming
7
- * Reversible Migrations
8
- * Assets Pipeline
9
- * jQuery as the default JavaScript library
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-1-stable) in the main Rails
14
- repository on GitHub.
15
-
16
- --------------------------------------------------------------------------------
17
-
18
- Upgrading to Rails 3.1
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 in case you haven't and make sure your application still runs as expected before attempting to update to Rails 3.1. Then take heed of the following changes:
22
-
23
- ### Rails 3.1 requires at least Ruby 1.8.7
24
-
25
- Rails 3.1 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.1 is also compatible with Ruby 1.9.2.
26
-
27
- TIP: Note that Ruby 1.8.7 p248 and p249 have marshaling bugs that crash Rails. Ruby Enterprise Edition have these fixed since release 1.8.7-2010.02 though. 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 1.9.2 for smooth sailing.
28
-
29
- ### What to update in your apps
30
-
31
- The following changes are meant for upgrading your application to Rails 3.1.3, the latest 3.1.x version of Rails.
32
-
33
- #### Gemfile
34
-
35
- Make the following changes to your `Gemfile`.
36
-
37
- ```ruby
38
- gem 'rails', '= 3.1.3'
39
- gem 'mysql2'
40
-
41
- # Needed for the new asset pipeline
42
- group :assets do
43
- gem 'sass-rails', "~> 3.1.5"
44
- gem 'coffee-rails', "~> 3.1.1"
45
- gem 'uglifier', ">= 1.0.3"
46
- end
47
-
48
- # jQuery is the default JavaScript library in Rails 3.1
49
- gem 'jquery-rails'
50
- ```
51
-
52
- #### config/application.rb
53
-
54
- * The asset pipeline requires the following additions:
55
-
56
- ```ruby
57
- config.assets.enabled = true
58
- config.assets.version = '1.0'
59
- ```
60
-
61
- * If your application is using the "/assets" route for a resource you may want change the prefix used for assets to avoid conflicts:
62
-
63
- ```ruby
64
- # Defaults to '/assets'
65
- config.assets.prefix = '/asset-files'
66
- ```
67
-
68
- #### config/environments/development.rb
69
-
70
- * Remove the RJS setting `config.action_view.debug_rjs = true`.
71
-
72
- * Add the following, if you enable the asset pipeline.
73
-
74
- ```ruby
75
- # Do not compress assets
76
- config.assets.compress = false
77
-
78
- # Expands the lines which load the assets
79
- config.assets.debug = true
80
- ```
81
-
82
- #### config/environments/production.rb
83
-
84
- * Again, most of the changes below are for the asset pipeline. You can read more about these in the [Asset Pipeline](asset_pipeline.html) guide.
85
-
86
- ```ruby
87
- # Compress JavaScripts and CSS
88
- config.assets.compress = true
89
-
90
- # Don't fallback to assets pipeline if a precompiled asset is missed
91
- config.assets.compile = false
92
-
93
- # Generate digests for assets URLs
94
- config.assets.digest = true
95
-
96
- # Defaults to Rails.root.join("public/assets")
97
- # config.assets.manifest = YOUR_PATH
98
-
99
- # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
100
- # config.assets.precompile `= %w( search.js )
101
-
102
-
103
- # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
104
- # config.force_ssl = true
105
- ```
106
-
107
- #### config/environments/test.rb
108
-
109
- ```ruby
110
- # Configure static asset server for tests with Cache-Control for performance
111
- config.serve_static_assets = true
112
- config.static_cache_control = "public, max-age=3600"
113
- ```
114
-
115
- #### config/initializers/wrap_parameters.rb
116
-
117
- * Add this file with the following contents, if you wish to wrap parameters into a nested hash. This is on by default in new applications.
118
-
119
- ```ruby
120
- # Be sure to restart your server when you modify this file.
121
- # This file contains settings for ActionController::ParamsWrapper which
122
- # is enabled by default.
123
-
124
- # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
125
- ActiveSupport.on_load(:action_controller) do
126
- wrap_parameters :format => [:json]
127
- end
128
-
129
- # Disable root element in JSON by default.
130
- ActiveSupport.on_load(:active_record) do
131
- self.include_root_in_json = false
132
- end
133
- ```
134
-
135
- #### Remove :cache and :concat options in asset helpers references in views
136
-
137
- * With the Asset Pipeline the :cache and :concat options aren't used anymore, delete these options from your views.
138
-
139
- Creating a Rails 3.1 application
140
- --------------------------------
141
-
142
- ```bash
143
- # You should have the 'rails' RubyGem installed
144
- $ rails new myapp
145
- $ cd myapp
146
- ```
147
-
148
- ### Vendoring Gems
149
-
150
- 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.
151
-
152
- More information: - [bundler homepage](http://gembundler.com)
153
-
154
- ### Living on the Edge
155
-
156
- `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:
157
-
158
- ```bash
159
- $ rails new myapp --edge
160
- ```
161
-
162
- If you have a local checkout of the Rails repository and want to generate an application using that, you can pass the `--dev` flag:
163
-
164
- ```bash
165
- $ ruby /path/to/rails/railties/bin/rails new myapp --dev
166
- ```
167
-
168
- Rails Architectural Changes
169
- ---------------------------
170
-
171
- ### Assets Pipeline
172
-
173
- The major change in Rails 3.1 is the Assets Pipeline. It makes CSS and JavaScript first-class code citizens and enables proper organization, including use in plugins and engines.
174
-
175
- The assets pipeline is powered by [Sprockets](https://github.com/rails/sprockets) and is covered in the [Asset Pipeline](asset_pipeline.html) guide.
176
-
177
- ### HTTP Streaming
178
-
179
- HTTP Streaming is another change that is new in Rails 3.1. This lets the browser download your stylesheets and JavaScript files while the server is still generating the response. This requires Ruby 1.9.2, is opt-in and requires support from the web server as well, but the popular combo of NGINX and Unicorn is ready to take advantage of it.
180
-
181
- ### Default JS library is now jQuery
182
-
183
- jQuery is the default JavaScript library that ships with Rails 3.1. But if you use Prototype, it's simple to switch.
184
-
185
- ```bash
186
- $ rails new myapp -j prototype
187
- ```
188
-
189
- ### Identity Map
190
-
191
- Active Record has an Identity Map in Rails 3.1. An identity map keeps previously instantiated records and returns the object associated with the record if accessed again. The identity map is created on a per-request basis and is flushed at request completion.
192
-
193
- Rails 3.1 comes with the identity map turned off by default.
194
-
195
- Railties
196
- --------
197
-
198
- * jQuery is the new default JavaScript library.
199
-
200
- * jQuery and Prototype are no longer vendored and is provided from now on by the jquery-rails and prototype-rails gems.
201
-
202
- * The application generator accepts an option `-j` which can be an arbitrary string. If passed "foo", the gem "foo-rails" is added to the `Gemfile`, and the application JavaScript manifest requires "foo" and "foo_ujs". Currently only "prototype-rails" and "jquery-rails" exist and provide those files via the asset pipeline.
203
-
204
- * Generating an application or a plugin runs `bundle install` unless `--skip-gemfile` or `--skip-bundle` is specified.
205
-
206
- * The controller and resource generators will now automatically produce asset stubs (this can be turned off with `--skip-assets`). These stubs will use CoffeeScript and Sass, if those libraries are available.
207
-
208
- * Scaffold and app generators use the Ruby 1.9 style hash when running on Ruby 1.9. To generate old style hash, `--old-style-hash` can be passed.
209
-
210
- * Scaffold controller generator creates format block for JSON instead of XML.
211
-
212
- * Active Record logging is directed to STDOUT and shown inline in the console.
213
-
214
- * Added `config.force_ssl` configuration which loads `Rack::SSL` middleware and force all requests to be under HTTPS protocol.
215
-
216
- * Added `rails plugin new` command which generates a Rails plugin with gemspec, tests and a dummy application for testing.
217
-
218
- * Added `Rack::Etag` and `Rack::ConditionalGet` to the default middleware stack.
219
-
220
- * Added `Rack::Cache` to the default middleware stack.
221
-
222
- * Engines received a major update - You can mount them at any path, enable assets, run generators etc.
223
-
224
- Action Pack
225
- -----------
226
-
227
- ### Action Controller
228
-
229
- * A warning is given out if the CSRF token authenticity cannot be verified.
230
-
231
- * Specify `force_ssl` in a controller to force the browser to transfer data via HTTPS protocol on that particular controller. To limit to specific actions, `:only` or `:except` can be used.
232
-
233
- * Sensitive query string parameters specified in `config.filter_parameters` will now be filtered out from the request paths in the log.
234
-
235
- * URL parameters which return `nil` for `to_param` are now removed from the query string.
236
-
237
- * Added `ActionController::ParamsWrapper` to wrap parameters into a nested hash, and will be turned on for JSON request in new applications by default. This can be customized in `config/initializers/wrap_parameters.rb`.
238
-
239
- * Added `config.action_controller.include_all_helpers`. By default `helper :all` is done in `ActionController::Base`, which includes all the helpers by default. Setting `include_all_helpers` to `false` will result in including only application_helper and the helper corresponding to controller (like foo_helper for foo_controller).
240
-
241
- * `url_for` and named url helpers now accept `:subdomain` and `:domain` as options.
242
-
243
- * Added `Base.http_basic_authenticate_with` to do simple http basic authentication with a single class method call.
244
-
245
- ```ruby
246
- class PostsController < ApplicationController
247
- USER_NAME, PASSWORD = "dhh", "secret"
248
-
249
- before_filter :authenticate, :except => [ :index ]
250
-
251
- def index
252
- render :text => "Everyone can see me!"
253
- end
254
-
255
- def edit
256
- render :text => "I'm only accessible if you know the password"
257
- end
258
-
259
- private
260
- def authenticate
261
- authenticate_or_request_with_http_basic do |user_name, password|
262
- user_name == USER_NAME && password == PASSWORD
263
- end
264
- end
265
- end
266
- ```
267
-
268
- ..can now be written as
269
-
270
- ```ruby
271
- class PostsController < ApplicationController
272
- http_basic_authenticate_with :name => "dhh", :password => "secret", :except => :index
273
-
274
- def index
275
- render :text => "Everyone can see me!"
276
- end
277
-
278
- def edit
279
- render :text => "I'm only accessible if you know the password"
280
- end
281
- end
282
- ```
283
-
284
- * Added streaming support, you can enable it with:
285
-
286
- ```ruby
287
- class PostsController < ActionController::Base
288
- stream
289
- end
290
- ```
291
-
292
- You can restrict it to some actions by using `:only` or `:except`. Please read the docs at [`ActionController::Streaming`](http://api.rubyonrails.org/v3.1.0/classes/ActionController/Streaming.html) for more information.
293
-
294
- * The redirect route method now also accepts a hash of options which will only change the parts of the url in question, or an object which responds to call, allowing for redirects to be reused.
295
-
296
- ### Action Dispatch
297
-
298
- * `config.action_dispatch.x_sendfile_header` now defaults to `nil` and `config/environments/production.rb` doesn't set any particular value for it. This allows servers to set it through `X-Sendfile-Type`.
299
-
300
- * `ActionDispatch::MiddlewareStack` now uses composition over inheritance and is no longer an array.
301
-
302
- * Added `ActionDispatch::Request.ignore_accept_header` to ignore accept headers.
303
-
304
- * Added `Rack::Cache` to the default stack.
305
-
306
- * Moved etag responsibility from `ActionDispatch::Response` to the middleware stack.
307
-
308
- * Rely on `Rack::Session` stores API for more compatibility across the Ruby world. This is backwards incompatible since `Rack::Session` expects `#get_session` to accept four arguments and requires `#destroy_session` instead of simply `#destroy`.
309
-
310
- * Template lookup now searches further up in the inheritance chain.
311
-
312
- ### Action View
313
-
314
- * Added an `:authenticity_token` option to `form_tag` for custom handling or to omit the token by passing `:authenticity_token => false`.
315
-
316
- * Created `ActionView::Renderer` and specified an API for `ActionView::Context`.
317
-
318
- * In place `SafeBuffer` mutation is prohibited in Rails 3.1.
319
-
320
- * Added HTML5 `button_tag` helper.
321
-
322
- * `file_field` automatically adds `:multipart => true` to the enclosing form.
323
-
324
- * Added a convenience idiom to generate HTML5 data-* attributes in tag helpers from a `:data` hash of options:
325
-
326
- ```ruby
327
- tag("div", :data => {:name => 'Stephen', :city_state => %w(Chicago IL)})
328
- # => <div data-name="Stephen" data-city-state="[&quot;Chicago&quot;,&quot;IL&quot;]" />
329
- ```
330
-
331
- Keys are dasherized. Values are JSON-encoded, except for strings and symbols.
332
-
333
- * `csrf_meta_tag` is renamed to `csrf_meta_tags` and aliases `csrf_meta_tag` for backwards compatibility.
334
-
335
- * The old template handler API is deprecated and the new API simply requires a template handler to respond to call.
336
-
337
- * rhtml and rxml are finally removed as template handlers.
338
-
339
- * `config.action_view.cache_template_loading` is brought back which allows to decide whether templates should be cached or not.
340
-
341
- * The submit form helper does not generate an id "object_name_id" anymore.
342
-
343
- * Allows `FormHelper#form_for` to specify the `:method` as a direct option instead of through the `:html` hash. `form_for(@post, remote: true, method: :delete)` instead of `form_for(@post, remote: true, html: { method: :delete })`.
344
-
345
- * Provided `JavaScriptHelper#j()` as an alias for `JavaScriptHelper#escape_javascript()`. This supersedes the `Object#j()` method that the JSON gem adds within templates using the JavaScriptHelper.
346
-
347
- * Allows AM/PM format in datetime selectors.
348
-
349
- * `auto_link` has been removed from Rails and extracted into the [rails_autolink gem](https://github.com/tenderlove/rails_autolink)
350
-
351
- Active Record
352
- -------------
353
-
354
- * Added a class method `pluralize_table_names` to singularize/pluralize table names of individual models. Previously this could only be set globally for all models through `ActiveRecord::Base.pluralize_table_names`.
355
-
356
- ```ruby
357
- class User < ActiveRecord::Base
358
- self.pluralize_table_names = false
359
- end
360
- ```
361
-
362
- * Added block setting of attributes to singular associations. The block will get called after the instance is initialized.
363
-
364
- ```ruby
365
- class User < ActiveRecord::Base
366
- has_one :account
367
- end
368
-
369
- user.build_account{ |a| a.credit_limit = 100.0 }
370
- ```
371
-
372
- * Added `ActiveRecord::Base.attribute_names` to return a list of attribute names. This will return an empty array if the model is abstract or the table does not exist.
373
-
374
- * CSV Fixtures are deprecated and support will be removed in Rails 3.2.0.
375
-
376
- * `ActiveRecord#new`, `ActiveRecord#create` and `ActiveRecord#update_attributes` all accept a second hash as an option that allows you to specify which role to consider when assigning attributes. This is built on top of Active Model's new mass assignment capabilities:
377
-
378
- ```ruby
379
- class Post < ActiveRecord::Base
380
- attr_accessible :title
381
- attr_accessible :title, :published_at, :as => :admin
382
- end
383
-
384
- Post.new(params[:post], :as => :admin)
385
- ```
386
-
387
- * `default_scope` can now take a block, lambda, or any other object which responds to call for lazy evaluation.
388
-
389
- * Default scopes are now evaluated at the latest possible moment, to avoid problems where scopes would be created which would implicitly contain the default scope, which would then be impossible to get rid of via Model.unscoped.
390
-
391
- * PostgreSQL adapter only supports PostgreSQL version 8.2 and higher.
392
-
393
- * `ConnectionManagement` middleware is changed to clean up the connection pool after the rack body has been flushed.
394
-
395
- * Added an `update_column` method on Active Record. This new method updates a given attribute on an object, skipping validations and callbacks. It is recommended to use `update_attributes` or `update_attribute` unless you are sure you do not want to execute any callback, including the modification of the `updated_at` column. It should not be called on new records.
396
-
397
- * Associations with a `:through` option can now use any association as the through or source association, including other associations which have a `:through` option and `has_and_belongs_to_many` associations.
398
-
399
- * The configuration for the current database connection is now accessible via `ActiveRecord::Base.connection_config`.
400
-
401
- * limits and offsets are removed from COUNT queries unless both are supplied.
402
-
403
- ```ruby
404
- People.limit(1).count # => 'SELECT COUNT(*) FROM people'
405
- People.offset(1).count # => 'SELECT COUNT(*) FROM people'
406
- People.limit(1).offset(1).count # => 'SELECT COUNT(*) FROM people LIMIT 1 OFFSET 1'
407
- ```
408
-
409
- * `ActiveRecord::Associations::AssociationProxy` has been split. There is now an `Association` class (and subclasses) which are responsible for operating on associations, and then a separate, thin wrapper called `CollectionProxy`, which proxies collection associations. This prevents namespace pollution, separates concerns, and will allow further refactorings.
410
-
411
- * Singular associations (`has_one`, `belongs_to`) no longer have a proxy and simply returns the associated record or `nil`. This means that you should not use undocumented methods such as `bob.mother.create` - use `bob.create_mother` instead.
412
-
413
- * Support the `:dependent` option on `has_many :through` associations. For historical and practical reasons, `:delete_all` is the default deletion strategy employed by `association.delete(*records)`, despite the fact that the default strategy is `:nullify` for regular has_many. Also, this only works at all if the source reflection is a belongs_to. For other situations, you should directly modify the through association.
414
-
415
- * The behavior of `association.destroy` for `has_and_belongs_to_many` and `has_many :through` is changed. From now on, 'destroy' or 'delete' on an association will be taken to mean 'get rid of the link', not (necessarily) 'get rid of the associated records'.
416
-
417
- * Previously, `has_and_belongs_to_many.destroy(*records)` would destroy the records themselves. It would not delete any records in the join table. Now, it deletes the records in the join table.
418
-
419
- * Previously, `has_many_through.destroy(*records)` would destroy the records themselves, and the records in the join table. [Note: This has not always been the case; previous version of Rails only deleted the records themselves.] Now, it destroys only the records in the join table.
420
-
421
- * Note that this change is backwards-incompatible to an extent, but there is unfortunately no way to 'deprecate' it before changing it. The change is being made in order to have consistency as to the meaning of 'destroy' or 'delete' across the different types of associations. If you wish to destroy the records themselves, you can do `records.association.each(&:destroy)`.
422
-
423
- * Add `:bulk => true` option to `change_table` to make all the schema changes defined in a block using a single ALTER statement.
424
-
425
- ```ruby
426
- change_table(:users, :bulk => true) do |t|
427
- t.string :company_name
428
- t.change :birthdate, :datetime
429
- end
430
- ```
431
-
432
- * Removed support for accessing attributes on a `has_and_belongs_to_many` join table. `has_many :through` needs to be used.
433
-
434
- * Added a `create_association!` method for `has_one` and `belongs_to` associations.
435
-
436
- * Migrations are now reversible, meaning that Rails will figure out how to reverse your migrations. To use reversible migrations, just define the `change` method.
437
-
438
- ```ruby
439
- class MyMigration < ActiveRecord::Migration
440
- def change
441
- create_table(:horses) do |t|
442
- t.column :content, :text
443
- t.column :remind_at, :datetime
444
- end
445
- end
446
- end
447
- ```
448
-
449
- * Some things cannot be automatically reversed for you. If you know how to reverse those things, you should define `up` and `down` in your migration. If you define something in change that cannot be reversed, an `IrreversibleMigration` exception will be raised when going down.
450
-
451
- * Migrations now use instance methods rather than class methods:
452
-
453
- ```ruby
454
- class FooMigration < ActiveRecord::Migration
455
- def up # Not self.up
456
- ...
457
- end
458
- end
459
- ```
460
-
461
- * Migration files generated from model and constructive migration generators (for example, add_name_to_users) use the reversible migration's `change` method instead of the ordinary `up` and `down` methods.
462
-
463
- * Removed support for interpolating string SQL conditions on associations. Instead, a proc should be used.
464
-
465
- ```ruby
466
- has_many :things, :conditions => 'foo = #{bar}' # before
467
- has_many :things, :conditions => proc { "foo = #{bar}" } # after
468
- ```
469
-
470
- Inside the proc, `self` is the object which is the owner of the association, unless you are eager loading the association, in which case `self` is the class which the association is within.
471
-
472
- You can have any "normal" conditions inside the proc, so the following will work too:
473
-
474
- ```ruby
475
- has_many :things, :conditions => proc { ["foo = ?", bar] }
476
- ```
477
-
478
- * Previously `:insert_sql` and `:delete_sql` on `has_and_belongs_to_many` association allowed you to call 'record' to get the record being inserted or deleted. This is now passed as an argument to the proc.
479
-
480
- * Added `ActiveRecord::Base#has_secure_password` (via `ActiveModel::SecurePassword`) to encapsulate dead-simple password usage with BCrypt encryption and salting.
481
-
482
- ```ruby
483
- # Schema: User(name:string, password_digest:string, password_salt:string)
484
- class User < ActiveRecord::Base
485
- has_secure_password
486
- end
487
- ```
488
-
489
- * When a model is generated `add_index` is added by default for `belongs_to` or `references` columns.
490
-
491
- * Setting the id of a `belongs_to` object will update the reference to the object.
492
-
493
- * `ActiveRecord::Base#dup` and `ActiveRecord::Base#clone` semantics have changed to closer match normal Ruby dup and clone semantics.
494
-
495
- * Calling `ActiveRecord::Base#clone` will result in a shallow copy of the record, including copying the frozen state. No callbacks will be called.
496
-
497
- * Calling `ActiveRecord::Base#dup` will duplicate the record, including calling after initialize hooks. Frozen state will not be copied, and all associations will be cleared. A duped record will return `true` for `new_record?`, have a `nil` id field, and is saveable.
498
-
499
- * The query cache now works with prepared statements. No changes in the applications are required.
500
-
501
- Active Model
502
- ------------
503
-
504
- * `attr_accessible` accepts an option `:as` to specify a role.
505
-
506
- * `InclusionValidator`, `ExclusionValidator`, and `FormatValidator` now accepts an option which can be a proc, a lambda, or anything that respond to `call`. This option will be called with the current record as an argument and returns an object which respond to `include?` for `InclusionValidator` and `ExclusionValidator`, and returns a regular expression object for `FormatValidator`.
507
-
508
- * Added `ActiveModel::SecurePassword` to encapsulate dead-simple password usage with BCrypt encryption and salting.
509
-
510
- * `ActiveModel::AttributeMethods` allows attributes to be defined on demand.
511
-
512
- * Added support for selectively enabling and disabling observers.
513
-
514
- * Alternate `I18n` namespace lookup is no longer supported.
515
-
516
- Active Resource
517
- ---------------
518
-
519
- * The default format has been changed to JSON for all requests. If you want to continue to use XML you will need to set `self.format = :xml` in the class. For example,
520
-
521
- ```ruby
522
- class User < ActiveResource::Base
523
- self.format = :xml
524
- end
525
- ```
526
-
527
- Active Support
528
- --------------
529
-
530
- * `ActiveSupport::Dependencies` now raises `NameError` if it finds an existing constant in `load_missing_constant`.
531
-
532
- * Added a new reporting method `Kernel#quietly` which silences both `STDOUT` and `STDERR`.
533
-
534
- * Added `String#inquiry` as a convenience method for turning a String into a `StringInquirer` object.
535
-
536
- * Added `Object#in?` to test if an object is included in another object.
537
-
538
- * `LocalCache` strategy is now a real middleware class and no longer an anonymous class.
539
-
540
- * `ActiveSupport::Dependencies::ClassCache` class has been introduced for holding references to reloadable classes.
541
-
542
- * `ActiveSupport::Dependencies::Reference` has been refactored to take direct advantage of the new `ClassCache`.
543
-
544
- * Backports `Range#cover?` as an alias for `Range#include?` in Ruby 1.8.
545
-
546
- * Added `weeks_ago` and `prev_week` to Date/DateTime/Time.
547
-
548
- * Added `before_remove_const` callback to `ActiveSupport::Dependencies.remove_unloadable_constants!`.
549
-
550
- Deprecations:
551
-
552
- * `ActiveSupport::SecureRandom` is deprecated in favor of `SecureRandom` from the Ruby standard library.
553
-
554
- Credits
555
- -------
556
-
557
- 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.
558
-
559
- Rails 3.1 Release Notes were compiled by [Vijay Dev](https://github.com/vijaydev.)