rails 4.1.14.2 → 5.2.4.4

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 (286) hide show
  1. checksums.yaml +5 -5
  2. data/README.md +33 -19
  3. metadata +65 -313
  4. data/guides/CHANGELOG.md +0 -106
  5. data/guides/Rakefile +0 -77
  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 -53
  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 -710
  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 -53
  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/code/getting_started/Gemfile +0 -40
  150. data/guides/code/getting_started/Gemfile.lock +0 -125
  151. data/guides/code/getting_started/README.rdoc +0 -28
  152. data/guides/code/getting_started/Rakefile +0 -6
  153. data/guides/code/getting_started/app/assets/javascripts/application.js +0 -15
  154. data/guides/code/getting_started/app/assets/javascripts/comments.js.coffee +0 -3
  155. data/guides/code/getting_started/app/assets/javascripts/posts.js.coffee +0 -3
  156. data/guides/code/getting_started/app/assets/javascripts/welcome.js.coffee +0 -3
  157. data/guides/code/getting_started/app/assets/stylesheets/application.css +0 -13
  158. data/guides/code/getting_started/app/assets/stylesheets/comments.css.scss +0 -3
  159. data/guides/code/getting_started/app/assets/stylesheets/posts.css.scss +0 -3
  160. data/guides/code/getting_started/app/assets/stylesheets/welcome.css.scss +0 -3
  161. data/guides/code/getting_started/app/controllers/application_controller.rb +0 -5
  162. data/guides/code/getting_started/app/controllers/comments_controller.rb +0 -23
  163. data/guides/code/getting_started/app/controllers/posts_controller.rb +0 -53
  164. data/guides/code/getting_started/app/controllers/welcome_controller.rb +0 -4
  165. data/guides/code/getting_started/app/helpers/application_helper.rb +0 -2
  166. data/guides/code/getting_started/app/helpers/comments_helper.rb +0 -2
  167. data/guides/code/getting_started/app/helpers/posts_helper.rb +0 -2
  168. data/guides/code/getting_started/app/helpers/welcome_helper.rb +0 -2
  169. data/guides/code/getting_started/app/models/comment.rb +0 -3
  170. data/guides/code/getting_started/app/models/post.rb +0 -7
  171. data/guides/code/getting_started/app/views/comments/_comment.html.erb +0 -15
  172. data/guides/code/getting_started/app/views/comments/_form.html.erb +0 -13
  173. data/guides/code/getting_started/app/views/layouts/application.html.erb +0 -14
  174. data/guides/code/getting_started/app/views/posts/_form.html.erb +0 -27
  175. data/guides/code/getting_started/app/views/posts/edit.html.erb +0 -5
  176. data/guides/code/getting_started/app/views/posts/index.html.erb +0 -21
  177. data/guides/code/getting_started/app/views/posts/new.html.erb +0 -5
  178. data/guides/code/getting_started/app/views/posts/show.html.erb +0 -18
  179. data/guides/code/getting_started/app/views/welcome/index.html.erb +0 -4
  180. data/guides/code/getting_started/bin/bundle +0 -4
  181. data/guides/code/getting_started/bin/rails +0 -4
  182. data/guides/code/getting_started/bin/rake +0 -4
  183. data/guides/code/getting_started/config.ru +0 -4
  184. data/guides/code/getting_started/config/application.rb +0 -18
  185. data/guides/code/getting_started/config/boot.rb +0 -4
  186. data/guides/code/getting_started/config/database.yml +0 -25
  187. data/guides/code/getting_started/config/environment.rb +0 -5
  188. data/guides/code/getting_started/config/environments/development.rb +0 -30
  189. data/guides/code/getting_started/config/environments/production.rb +0 -80
  190. data/guides/code/getting_started/config/environments/test.rb +0 -36
  191. data/guides/code/getting_started/config/initializers/backtrace_silencers.rb +0 -7
  192. data/guides/code/getting_started/config/initializers/filter_parameter_logging.rb +0 -4
  193. data/guides/code/getting_started/config/initializers/inflections.rb +0 -16
  194. data/guides/code/getting_started/config/initializers/locale.rb +0 -9
  195. data/guides/code/getting_started/config/initializers/mime_types.rb +0 -5
  196. data/guides/code/getting_started/config/initializers/secret_token.rb +0 -12
  197. data/guides/code/getting_started/config/initializers/session_store.rb +0 -3
  198. data/guides/code/getting_started/config/initializers/wrap_parameters.rb +0 -14
  199. data/guides/code/getting_started/config/locales/en.yml +0 -23
  200. data/guides/code/getting_started/config/routes.rb +0 -7
  201. data/guides/code/getting_started/db/migrate/20130122042648_create_posts.rb +0 -10
  202. data/guides/code/getting_started/db/migrate/20130122045842_create_comments.rb +0 -11
  203. data/guides/code/getting_started/db/schema.rb +0 -33
  204. data/guides/code/getting_started/db/seeds.rb +0 -7
  205. data/guides/code/getting_started/public/404.html +0 -60
  206. data/guides/code/getting_started/public/422.html +0 -60
  207. data/guides/code/getting_started/public/500.html +0 -59
  208. data/guides/code/getting_started/public/favicon.ico +0 -0
  209. data/guides/code/getting_started/public/robots.txt +0 -5
  210. data/guides/code/getting_started/test/controllers/comments_controller_test.rb +0 -7
  211. data/guides/code/getting_started/test/controllers/posts_controller_test.rb +0 -7
  212. data/guides/code/getting_started/test/controllers/welcome_controller_test.rb +0 -9
  213. data/guides/code/getting_started/test/fixtures/comments.yml +0 -11
  214. data/guides/code/getting_started/test/fixtures/posts.yml +0 -9
  215. data/guides/code/getting_started/test/helpers/comments_helper_test.rb +0 -4
  216. data/guides/code/getting_started/test/helpers/posts_helper_test.rb +0 -4
  217. data/guides/code/getting_started/test/helpers/welcome_helper_test.rb +0 -4
  218. data/guides/code/getting_started/test/models/comment_test.rb +0 -7
  219. data/guides/code/getting_started/test/models/post_test.rb +0 -7
  220. data/guides/code/getting_started/test/test_helper.rb +0 -12
  221. data/guides/rails_guides.rb +0 -63
  222. data/guides/rails_guides/generator.rb +0 -248
  223. data/guides/rails_guides/helpers.rb +0 -53
  224. data/guides/rails_guides/indexer.rb +0 -68
  225. data/guides/rails_guides/kindle.rb +0 -119
  226. data/guides/rails_guides/levenshtein.rb +0 -31
  227. data/guides/rails_guides/markdown.rb +0 -163
  228. data/guides/rails_guides/markdown/renderer.rb +0 -82
  229. data/guides/source/2_2_release_notes.md +0 -435
  230. data/guides/source/2_3_release_notes.md +0 -621
  231. data/guides/source/3_0_release_notes.md +0 -611
  232. data/guides/source/3_1_release_notes.md +0 -556
  233. data/guides/source/3_2_release_notes.md +0 -565
  234. data/guides/source/4_0_release_notes.md +0 -276
  235. data/guides/source/4_1_release_notes.md +0 -731
  236. data/guides/source/_license.html.erb +0 -2
  237. data/guides/source/_welcome.html.erb +0 -25
  238. data/guides/source/action_controller_overview.md +0 -1175
  239. data/guides/source/action_mailer_basics.md +0 -689
  240. data/guides/source/action_view_overview.md +0 -1602
  241. data/guides/source/active_model_basics.md +0 -200
  242. data/guides/source/active_record_basics.md +0 -373
  243. data/guides/source/active_record_callbacks.md +0 -410
  244. data/guides/source/active_record_querying.md +0 -1785
  245. data/guides/source/active_record_validations.md +0 -1169
  246. data/guides/source/active_support_core_extensions.md +0 -3817
  247. data/guides/source/active_support_instrumentation.md +0 -496
  248. data/guides/source/api_documentation_guidelines.md +0 -315
  249. data/guides/source/asset_pipeline.md +0 -1165
  250. data/guides/source/association_basics.md +0 -2229
  251. data/guides/source/caching_with_rails.md +0 -354
  252. data/guides/source/command_line.md +0 -603
  253. data/guides/source/configuring.md +0 -942
  254. data/guides/source/contributing_to_ruby_on_rails.md +0 -544
  255. data/guides/source/credits.html.erb +0 -80
  256. data/guides/source/debugging_rails_applications.md +0 -707
  257. data/guides/source/development_dependencies_install.md +0 -278
  258. data/guides/source/documents.yaml +0 -193
  259. data/guides/source/engines.md +0 -1412
  260. data/guides/source/form_helpers.md +0 -1001
  261. data/guides/source/generators.md +0 -663
  262. data/guides/source/getting_started.md +0 -1946
  263. data/guides/source/i18n.md +0 -1043
  264. data/guides/source/index.html.erb +0 -27
  265. data/guides/source/initialization.md +0 -657
  266. data/guides/source/kindle/copyright.html.erb +0 -1
  267. data/guides/source/kindle/layout.html.erb +0 -27
  268. data/guides/source/kindle/rails_guides.opf.erb +0 -52
  269. data/guides/source/kindle/toc.html.erb +0 -24
  270. data/guides/source/kindle/toc.ncx.erb +0 -64
  271. data/guides/source/kindle/welcome.html.erb +0 -5
  272. data/guides/source/layout.html.erb +0 -146
  273. data/guides/source/layouts_and_rendering.md +0 -1226
  274. data/guides/source/maintenance_policy.md +0 -75
  275. data/guides/source/migrations.md +0 -1143
  276. data/guides/source/nested_model_forms.md +0 -225
  277. data/guides/source/plugins.md +0 -444
  278. data/guides/source/rails_application_templates.md +0 -248
  279. data/guides/source/rails_on_rack.md +0 -332
  280. data/guides/source/routing.md +0 -1115
  281. data/guides/source/ruby_on_rails_guides_guidelines.md +0 -128
  282. data/guides/source/security.md +0 -1018
  283. data/guides/source/testing.md +0 -1052
  284. data/guides/source/upgrading_ruby_on_rails.md +0 -928
  285. data/guides/source/working_with_javascript_in_rails.md +0 -405
  286. data/guides/w3c_validator.rb +0 -95
@@ -1,556 +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
- This release notes cover the major changes, but don't include every little bug fix and change. If you want to see everything, check out the [list of commits](https://github.com/rails/rails/commits/master) in the main Rails repository on GitHub.
12
-
13
- --------------------------------------------------------------------------------
14
-
15
- Upgrading to Rails 3.1
16
- ----------------------
17
-
18
- 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:
19
-
20
- ### Rails 3.1 requires at least Ruby 1.8.7
21
-
22
- 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.
23
-
24
- 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.
25
-
26
- ### What to update in your apps
27
-
28
- The following changes are meant for upgrading your application to Rails 3.1.3, the latest 3.1.x version of Rails.
29
-
30
- #### Gemfile
31
-
32
- Make the following changes to your `Gemfile`.
33
-
34
- ```ruby
35
- gem 'rails', '= 3.1.3'
36
- gem 'mysql2'
37
-
38
- # Needed for the new asset pipeline
39
- group :assets do
40
- gem 'sass-rails', "~> 3.1.5"
41
- gem 'coffee-rails', "~> 3.1.1"
42
- gem 'uglifier', ">= 1.0.3"
43
- end
44
-
45
- # jQuery is the default JavaScript library in Rails 3.1
46
- gem 'jquery-rails'
47
- ```
48
-
49
- #### config/application.rb
50
-
51
- * The asset pipeline requires the following additions:
52
-
53
- ```ruby
54
- config.assets.enabled = true
55
- config.assets.version = '1.0'
56
- ```
57
-
58
- * If your application is using the "/assets" route for a resource you may want change the prefix used for assets to avoid conflicts:
59
-
60
- ```ruby
61
- # Defaults to '/assets'
62
- config.assets.prefix = '/asset-files'
63
- ```
64
-
65
- #### config/environments/development.rb
66
-
67
- * Remove the RJS setting `config.action_view.debug_rjs = true`.
68
-
69
- * Add the following, if you enable the asset pipeline.
70
-
71
- ```ruby
72
- # Do not compress assets
73
- config.assets.compress = false
74
-
75
- # Expands the lines which load the assets
76
- config.assets.debug = true
77
- ```
78
-
79
- #### config/environments/production.rb
80
-
81
- * 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.
82
-
83
- ```ruby
84
- # Compress JavaScripts and CSS
85
- config.assets.compress = true
86
-
87
- # Don't fallback to assets pipeline if a precompiled asset is missed
88
- config.assets.compile = false
89
-
90
- # Generate digests for assets URLs
91
- config.assets.digest = true
92
-
93
- # Defaults to Rails.root.join("public/assets")
94
- # config.assets.manifest = YOUR_PATH
95
-
96
- # Precompile additional assets (application.js, application.css, and all non-JS/CSS are already added)
97
- # config.assets.precompile `= %w( search.js )
98
-
99
-
100
- # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
101
- # config.force_ssl = true
102
- ```
103
-
104
- #### config/environments/test.rb
105
-
106
- ```ruby
107
- # Configure static asset server for tests with Cache-Control for performance
108
- config.serve_static_assets = true
109
- config.static_cache_control = "public, max-age=3600"
110
- ```
111
-
112
- #### config/initializers/wrap_parameters.rb
113
-
114
- * 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.
115
-
116
- ```ruby
117
- # Be sure to restart your server when you modify this file.
118
- # This file contains settings for ActionController::ParamsWrapper which
119
- # is enabled by default.
120
-
121
- # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array.
122
- ActiveSupport.on_load(:action_controller) do
123
- wrap_parameters :format => [:json]
124
- end
125
-
126
- # Disable root element in JSON by default.
127
- ActiveSupport.on_load(:active_record) do
128
- self.include_root_in_json = false
129
- end
130
- ```
131
-
132
- #### Remove :cache and :concat options in asset helpers references in views
133
-
134
- * With the Asset Pipeline the :cache and :concat options aren't used anymore, delete these options from your views.
135
-
136
- Creating a Rails 3.1 application
137
- --------------------------------
138
-
139
- ```bash
140
- # You should have the 'rails' RubyGem installed
141
- $ rails new myapp
142
- $ cd myapp
143
- ```
144
-
145
- ### Vendoring Gems
146
-
147
- 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.
148
-
149
- More information: - [bundler homepage](http://gembundler.com)
150
-
151
- ### Living on the Edge
152
-
153
- `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:
154
-
155
- ```bash
156
- $ rails new myapp --edge
157
- ```
158
-
159
- If you have a local checkout of the Rails repository and want to generate an application using that, you can pass the `--dev` flag:
160
-
161
- ```bash
162
- $ ruby /path/to/rails/railties/bin/rails new myapp --dev
163
- ```
164
-
165
- Rails Architectural Changes
166
- ---------------------------
167
-
168
- ### Assets Pipeline
169
-
170
- 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.
171
-
172
- The assets pipeline is powered by [Sprockets](https://github.com/rails/sprockets) and is covered in the [Asset Pipeline](asset_pipeline.html) guide.
173
-
174
- ### HTTP Streaming
175
-
176
- 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.
177
-
178
- ### Default JS library is now jQuery
179
-
180
- jQuery is the default JavaScript library that ships with Rails 3.1. But if you use Prototype, it's simple to switch.
181
-
182
- ```bash
183
- $ rails new myapp -j prototype
184
- ```
185
-
186
- ### Identity Map
187
-
188
- 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.
189
-
190
- Rails 3.1 comes with the identity map turned off by default.
191
-
192
- Railties
193
- --------
194
-
195
- * jQuery is the new default JavaScript library.
196
-
197
- * jQuery and Prototype are no longer vendored and is provided from now on by the jquery-rails and prototype-rails gems.
198
-
199
- * 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.
200
-
201
- * Generating an application or a plugin runs `bundle install` unless `--skip-gemfile` or `--skip-bundle` is specified.
202
-
203
- * 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.
204
-
205
- * 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.
206
-
207
- * Scaffold controller generator creates format block for JSON instead of XML.
208
-
209
- * Active Record logging is directed to STDOUT and shown inline in the console.
210
-
211
- * Added `config.force_ssl` configuration which loads `Rack::SSL` middleware and force all requests to be under HTTPS protocol.
212
-
213
- * Added `rails plugin new` command which generates a Rails plugin with gemspec, tests and a dummy application for testing.
214
-
215
- * Added `Rack::Etag` and `Rack::ConditionalGet` to the default middleware stack.
216
-
217
- * Added `Rack::Cache` to the default middleware stack.
218
-
219
- * Engines received a major update - You can mount them at any path, enable assets, run generators etc.
220
-
221
- Action Pack
222
- -----------
223
-
224
- ### Action Controller
225
-
226
- * A warning is given out if the CSRF token authenticity cannot be verified.
227
-
228
- * 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.
229
-
230
- * Sensitive query string parameters specified in `config.filter_parameters` will now be filtered out from the request paths in the log.
231
-
232
- * URL parameters which return `nil` for `to_param` are now removed from the query string.
233
-
234
- * 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`.
235
-
236
- * 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).
237
-
238
- * `url_for` and named url helpers now accept `:subdomain` and `:domain` as options.
239
-
240
- * Added `Base.http_basic_authenticate_with` to do simple http basic authentication with a single class method call.
241
-
242
- ```ruby
243
- class PostsController < ApplicationController
244
- USER_NAME, PASSWORD = "dhh", "secret"
245
-
246
- before_filter :authenticate, :except => [ :index ]
247
-
248
- def index
249
- render :text => "Everyone can see me!"
250
- end
251
-
252
- def edit
253
- render :text => "I'm only accessible if you know the password"
254
- end
255
-
256
- private
257
- def authenticate
258
- authenticate_or_request_with_http_basic do |user_name, password|
259
- user_name == USER_NAME && password == PASSWORD
260
- end
261
- end
262
- end
263
- ```
264
-
265
- ..can now be written as
266
-
267
- ```ruby
268
- class PostsController < ApplicationController
269
- http_basic_authenticate_with :name => "dhh", :password => "secret", :except => :index
270
-
271
- def index
272
- render :text => "Everyone can see me!"
273
- end
274
-
275
- def edit
276
- render :text => "I'm only accessible if you know the password"
277
- end
278
- end
279
- ```
280
-
281
- * Added streaming support, you can enable it with:
282
-
283
- ```ruby
284
- class PostsController < ActionController::Base
285
- stream
286
- end
287
- ```
288
-
289
- 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.
290
-
291
- * 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.
292
-
293
- ### Action Dispatch
294
-
295
- * `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`.
296
-
297
- * `ActionDispatch::MiddlewareStack` now uses composition over inheritance and is no longer an array.
298
-
299
- * Added `ActionDispatch::Request.ignore_accept_header` to ignore accept headers.
300
-
301
- * Added `Rack::Cache` to the default stack.
302
-
303
- * Moved etag responsibility from `ActionDispatch::Response` to the middleware stack.
304
-
305
- * 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`.
306
-
307
- * Template lookup now searches further up in the inheritance chain.
308
-
309
- ### Action View
310
-
311
- * Added an `:authenticity_token` option to `form_tag` for custom handling or to omit the token by passing `:authenticity_token => false`.
312
-
313
- * Created `ActionView::Renderer` and specified an API for `ActionView::Context`.
314
-
315
- * In place `SafeBuffer` mutation is prohibited in Rails 3.1.
316
-
317
- * Added HTML5 `button_tag` helper.
318
-
319
- * `file_field` automatically adds `:multipart => true` to the enclosing form.
320
-
321
- * Added a convenience idiom to generate HTML5 data-* attributes in tag helpers from a `:data` hash of options:
322
-
323
- ```ruby
324
- tag("div", :data => {:name => 'Stephen', :city_state => %w(Chicago IL)})
325
- # => <div data-name="Stephen" data-city-state="[&quot;Chicago&quot;,&quot;IL&quot;]" />
326
- ```
327
-
328
- Keys are dasherized. Values are JSON-encoded, except for strings and symbols.
329
-
330
- * `csrf_meta_tag` is renamed to `csrf_meta_tags` and aliases `csrf_meta_tag` for backwards compatibility.
331
-
332
- * The old template handler API is deprecated and the new API simply requires a template handler to respond to call.
333
-
334
- * rhtml and rxml are finally removed as template handlers.
335
-
336
- * `config.action_view.cache_template_loading` is brought back which allows to decide whether templates should be cached or not.
337
-
338
- * The submit form helper does not generate an id "object_name_id" anymore.
339
-
340
- * 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 })`.
341
-
342
- * 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.
343
-
344
- * Allows AM/PM format in datetime selectors.
345
-
346
- * `auto_link` has been removed from Rails and extracted into the [rails_autolink gem](https://github.com/tenderlove/rails_autolink)
347
-
348
- Active Record
349
- -------------
350
-
351
- * 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`.
352
-
353
- ```ruby
354
- class User < ActiveRecord::Base
355
- self.pluralize_table_names = false
356
- end
357
- ```
358
-
359
- * Added block setting of attributes to singular associations. The block will get called after the instance is initialized.
360
-
361
- ```ruby
362
- class User < ActiveRecord::Base
363
- has_one :account
364
- end
365
-
366
- user.build_account{ |a| a.credit_limit = 100.0 }
367
- ```
368
-
369
- * 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.
370
-
371
- * CSV Fixtures are deprecated and support will be removed in Rails 3.2.0.
372
-
373
- * `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:
374
-
375
- ```ruby
376
- class Post < ActiveRecord::Base
377
- attr_accessible :title
378
- attr_accessible :title, :published_at, :as => :admin
379
- end
380
-
381
- Post.new(params[:post], :as => :admin)
382
- ```
383
-
384
- * `default_scope` can now take a block, lambda, or any other object which responds to call for lazy evaluation.
385
-
386
- * 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.
387
-
388
- * PostgreSQL adapter only supports PostgreSQL version 8.2 and higher.
389
-
390
- * `ConnectionManagement` middleware is changed to clean up the connection pool after the rack body has been flushed.
391
-
392
- * 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.
393
-
394
- * 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.
395
-
396
- * The configuration for the current database connection is now accessible via `ActiveRecord::Base.connection_config`.
397
-
398
- * limits and offsets are removed from COUNT queries unless both are supplied.
399
-
400
- ```ruby
401
- People.limit(1).count # => 'SELECT COUNT(*) FROM people'
402
- People.offset(1).count # => 'SELECT COUNT(*) FROM people'
403
- People.limit(1).offset(1).count # => 'SELECT COUNT(*) FROM people LIMIT 1 OFFSET 1'
404
- ```
405
-
406
- * `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.
407
-
408
- * 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.
409
-
410
- * 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.
411
-
412
- * 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'.
413
-
414
- * 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.
415
-
416
- * 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.
417
-
418
- * 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)`.
419
-
420
- * Add `:bulk => true` option to `change_table` to make all the schema changes defined in a block using a single ALTER statement.
421
-
422
- ```ruby
423
- change_table(:users, :bulk => true) do |t|
424
- t.string :company_name
425
- t.change :birthdate, :datetime
426
- end
427
- ```
428
-
429
- * Removed support for accessing attributes on a `has_and_belongs_to_many` join table. `has_many :through` needs to be used.
430
-
431
- * Added a `create_association!` method for `has_one` and `belongs_to` associations.
432
-
433
- * Migrations are now reversible, meaning that Rails will figure out how to reverse your migrations. To use reversible migrations, just define the `change` method.
434
-
435
- ```ruby
436
- class MyMigration < ActiveRecord::Migration
437
- def change
438
- create_table(:horses) do |t|
439
- t.column :content, :text
440
- t.column :remind_at, :datetime
441
- end
442
- end
443
- end
444
- ```
445
-
446
- * 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.
447
-
448
- * Migrations now use instance methods rather than class methods:
449
-
450
- ```ruby
451
- class FooMigration < ActiveRecord::Migration
452
- def up # Not self.up
453
- ...
454
- end
455
- end
456
- ```
457
-
458
- * 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.
459
-
460
- * Removed support for interpolating string SQL conditions on associations. Instead, a proc should be used.
461
-
462
- ```ruby
463
- has_many :things, :conditions => 'foo = #{bar}' # before
464
- has_many :things, :conditions => proc { "foo = #{bar}" } # after
465
- ```
466
-
467
- 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.
468
-
469
- You can have any "normal" conditions inside the proc, so the following will work too:
470
-
471
- ```ruby
472
- has_many :things, :conditions => proc { ["foo = ?", bar] }
473
- ```
474
-
475
- * 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.
476
-
477
- * Added `ActiveRecord::Base#has_secure_password` (via `ActiveModel::SecurePassword`) to encapsulate dead-simple password usage with BCrypt encryption and salting.
478
-
479
- ```ruby
480
- # Schema: User(name:string, password_digest:string, password_salt:string)
481
- class User < ActiveRecord::Base
482
- has_secure_password
483
- end
484
- ```
485
-
486
- * When a model is generated `add_index` is added by default for `belongs_to` or `references` columns.
487
-
488
- * Setting the id of a `belongs_to` object will update the reference to the object.
489
-
490
- * `ActiveRecord::Base#dup` and `ActiveRecord::Base#clone` semantics have changed to closer match normal Ruby dup and clone semantics.
491
-
492
- * Calling `ActiveRecord::Base#clone` will result in a shallow copy of the record, including copying the frozen state. No callbacks will be called.
493
-
494
- * 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.
495
-
496
- * The query cache now works with prepared statements. No changes in the applications are required.
497
-
498
- Active Model
499
- ------------
500
-
501
- * `attr_accessible` accepts an option `:as` to specify a role.
502
-
503
- * `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`.
504
-
505
- * Added `ActiveModel::SecurePassword` to encapsulate dead-simple password usage with BCrypt encryption and salting.
506
-
507
- * `ActiveModel::AttributeMethods` allows attributes to be defined on demand.
508
-
509
- * Added support for selectively enabling and disabling observers.
510
-
511
- * Alternate `I18n` namespace lookup is no longer supported.
512
-
513
- Active Resource
514
- ---------------
515
-
516
- * 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,
517
-
518
- ```ruby
519
- class User < ActiveResource::Base
520
- self.format = :xml
521
- end
522
- ```
523
-
524
- Active Support
525
- --------------
526
-
527
- * `ActiveSupport::Dependencies` now raises `NameError` if it finds an existing constant in `load_missing_constant`.
528
-
529
- * Added a new reporting method `Kernel#quietly` which silences both `STDOUT` and `STDERR`.
530
-
531
- * Added `String#inquiry` as a convenience method for turning a String into a `StringInquirer` object.
532
-
533
- * Added `Object#in?` to test if an object is included in another object.
534
-
535
- * `LocalCache` strategy is now a real middleware class and no longer an anonymous class.
536
-
537
- * `ActiveSupport::Dependencies::ClassCache` class has been introduced for holding references to reloadable classes.
538
-
539
- * `ActiveSupport::Dependencies::Reference` has been refactored to take direct advantage of the new `ClassCache`.
540
-
541
- * Backports `Range#cover?` as an alias for `Range#include?` in Ruby 1.8.
542
-
543
- * Added `weeks_ago` and `prev_week` to Date/DateTime/Time.
544
-
545
- * Added `before_remove_const` callback to `ActiveSupport::Dependencies.remove_unloadable_constants!`.
546
-
547
- Deprecations:
548
-
549
- * `ActiveSupport::SecureRandom` is deprecated in favor of `SecureRandom` from the Ruby standard library.
550
-
551
- Credits
552
- -------
553
-
554
- 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.
555
-
556
- Rails 3.1 Release Notes were compiled by [Vijay Dev](https://github.com/vijaydev.)