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.
- checksums.yaml +5 -5
- data/README.md +33 -19
- metadata +65 -313
- data/guides/CHANGELOG.md +0 -106
- data/guides/Rakefile +0 -77
- data/guides/assets/images/akshaysurve.jpg +0 -0
- data/guides/assets/images/belongs_to.png +0 -0
- data/guides/assets/images/book_icon.gif +0 -0
- data/guides/assets/images/bullet.gif +0 -0
- data/guides/assets/images/chapters_icon.gif +0 -0
- data/guides/assets/images/check_bullet.gif +0 -0
- data/guides/assets/images/credits_pic_blank.gif +0 -0
- data/guides/assets/images/csrf.png +0 -0
- data/guides/assets/images/edge_badge.png +0 -0
- data/guides/assets/images/favicon.ico +0 -0
- data/guides/assets/images/feature_tile.gif +0 -0
- data/guides/assets/images/footer_tile.gif +0 -0
- data/guides/assets/images/fxn.png +0 -0
- data/guides/assets/images/getting_started/article_with_comments.png +0 -0
- data/guides/assets/images/getting_started/challenge.png +0 -0
- data/guides/assets/images/getting_started/confirm_dialog.png +0 -0
- data/guides/assets/images/getting_started/forbidden_attributes_for_new_article.png +0 -0
- data/guides/assets/images/getting_started/form_with_errors.png +0 -0
- data/guides/assets/images/getting_started/index_action_with_edit_link.png +0 -0
- data/guides/assets/images/getting_started/new_article.png +0 -0
- data/guides/assets/images/getting_started/rails_welcome.png +0 -0
- data/guides/assets/images/getting_started/routing_error_no_controller.png +0 -0
- data/guides/assets/images/getting_started/routing_error_no_route_matches.png +0 -0
- data/guides/assets/images/getting_started/show_action_for_articles.png +0 -0
- data/guides/assets/images/getting_started/template_is_missing_articles_new.png +0 -0
- data/guides/assets/images/getting_started/unknown_action_create_for_articles.png +0 -0
- data/guides/assets/images/getting_started/unknown_action_new_for_articles.png +0 -0
- data/guides/assets/images/grey_bullet.gif +0 -0
- data/guides/assets/images/habtm.png +0 -0
- data/guides/assets/images/has_many.png +0 -0
- data/guides/assets/images/has_many_through.png +0 -0
- data/guides/assets/images/has_one.png +0 -0
- data/guides/assets/images/has_one_through.png +0 -0
- data/guides/assets/images/header_backdrop.png +0 -0
- data/guides/assets/images/header_tile.gif +0 -0
- data/guides/assets/images/i18n/demo_html_safe.png +0 -0
- data/guides/assets/images/i18n/demo_localized_pirate.png +0 -0
- data/guides/assets/images/i18n/demo_translated_en.png +0 -0
- data/guides/assets/images/i18n/demo_translated_pirate.png +0 -0
- data/guides/assets/images/i18n/demo_translation_missing.png +0 -0
- data/guides/assets/images/i18n/demo_untranslated.png +0 -0
- data/guides/assets/images/icons/README +0 -5
- data/guides/assets/images/icons/callouts/1.png +0 -0
- data/guides/assets/images/icons/callouts/10.png +0 -0
- data/guides/assets/images/icons/callouts/11.png +0 -0
- data/guides/assets/images/icons/callouts/12.png +0 -0
- data/guides/assets/images/icons/callouts/13.png +0 -0
- data/guides/assets/images/icons/callouts/14.png +0 -0
- data/guides/assets/images/icons/callouts/15.png +0 -0
- data/guides/assets/images/icons/callouts/2.png +0 -0
- data/guides/assets/images/icons/callouts/3.png +0 -0
- data/guides/assets/images/icons/callouts/4.png +0 -0
- data/guides/assets/images/icons/callouts/5.png +0 -0
- data/guides/assets/images/icons/callouts/6.png +0 -0
- data/guides/assets/images/icons/callouts/7.png +0 -0
- data/guides/assets/images/icons/callouts/8.png +0 -0
- data/guides/assets/images/icons/callouts/9.png +0 -0
- data/guides/assets/images/icons/caution.png +0 -0
- data/guides/assets/images/icons/example.png +0 -0
- data/guides/assets/images/icons/home.png +0 -0
- data/guides/assets/images/icons/important.png +0 -0
- data/guides/assets/images/icons/next.png +0 -0
- data/guides/assets/images/icons/note.png +0 -0
- data/guides/assets/images/icons/prev.png +0 -0
- data/guides/assets/images/icons/tip.png +0 -0
- data/guides/assets/images/icons/up.png +0 -0
- data/guides/assets/images/icons/warning.png +0 -0
- data/guides/assets/images/nav_arrow.gif +0 -0
- data/guides/assets/images/oscardelben.jpg +0 -0
- data/guides/assets/images/polymorphic.png +0 -0
- data/guides/assets/images/radar.png +0 -0
- data/guides/assets/images/rails4_features.png +0 -0
- data/guides/assets/images/rails_guides_kindle_cover.jpg +0 -0
- data/guides/assets/images/rails_guides_logo.gif +0 -0
- data/guides/assets/images/rails_logo_remix.gif +0 -0
- data/guides/assets/images/session_fixation.png +0 -0
- data/guides/assets/images/tab_grey.gif +0 -0
- data/guides/assets/images/tab_info.gif +0 -0
- data/guides/assets/images/tab_note.gif +0 -0
- data/guides/assets/images/tab_red.gif +0 -0
- data/guides/assets/images/tab_yellow.gif +0 -0
- data/guides/assets/images/tab_yellow.png +0 -0
- data/guides/assets/images/vijaydev.jpg +0 -0
- data/guides/assets/javascripts/guides.js +0 -53
- data/guides/assets/javascripts/jquery.min.js +0 -4
- data/guides/assets/javascripts/responsive-tables.js +0 -43
- data/guides/assets/javascripts/syntaxhighlighter/shBrushAS3.js +0 -59
- data/guides/assets/javascripts/syntaxhighlighter/shBrushAppleScript.js +0 -75
- data/guides/assets/javascripts/syntaxhighlighter/shBrushBash.js +0 -59
- data/guides/assets/javascripts/syntaxhighlighter/shBrushCSharp.js +0 -65
- data/guides/assets/javascripts/syntaxhighlighter/shBrushColdFusion.js +0 -100
- data/guides/assets/javascripts/syntaxhighlighter/shBrushCpp.js +0 -97
- data/guides/assets/javascripts/syntaxhighlighter/shBrushCss.js +0 -91
- data/guides/assets/javascripts/syntaxhighlighter/shBrushDelphi.js +0 -55
- data/guides/assets/javascripts/syntaxhighlighter/shBrushDiff.js +0 -41
- data/guides/assets/javascripts/syntaxhighlighter/shBrushErlang.js +0 -52
- data/guides/assets/javascripts/syntaxhighlighter/shBrushGroovy.js +0 -67
- data/guides/assets/javascripts/syntaxhighlighter/shBrushJScript.js +0 -52
- data/guides/assets/javascripts/syntaxhighlighter/shBrushJava.js +0 -57
- data/guides/assets/javascripts/syntaxhighlighter/shBrushJavaFX.js +0 -58
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPerl.js +0 -72
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPhp.js +0 -88
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPlain.js +0 -33
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPowerShell.js +0 -74
- data/guides/assets/javascripts/syntaxhighlighter/shBrushPython.js +0 -64
- data/guides/assets/javascripts/syntaxhighlighter/shBrushRuby.js +0 -55
- data/guides/assets/javascripts/syntaxhighlighter/shBrushSass.js +0 -94
- data/guides/assets/javascripts/syntaxhighlighter/shBrushScala.js +0 -51
- data/guides/assets/javascripts/syntaxhighlighter/shBrushSql.js +0 -66
- data/guides/assets/javascripts/syntaxhighlighter/shBrushVb.js +0 -56
- data/guides/assets/javascripts/syntaxhighlighter/shBrushXml.js +0 -69
- data/guides/assets/javascripts/syntaxhighlighter/shCore.js +0 -17
- data/guides/assets/stylesheets/fixes.css +0 -16
- data/guides/assets/stylesheets/kindle.css +0 -11
- data/guides/assets/stylesheets/main.css +0 -710
- data/guides/assets/stylesheets/print.css +0 -52
- data/guides/assets/stylesheets/reset.css +0 -43
- data/guides/assets/stylesheets/responsive-tables.css +0 -50
- data/guides/assets/stylesheets/style.css +0 -13
- data/guides/assets/stylesheets/syntaxhighlighter/shCore.css +0 -226
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreDefault.css +0 -328
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreDjango.css +0 -331
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreEclipse.css +0 -339
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreEmacs.css +0 -324
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreFadeToGrey.css +0 -328
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreMDUltra.css +0 -324
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreMidnight.css +0 -324
- data/guides/assets/stylesheets/syntaxhighlighter/shCoreRDark.css +0 -324
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeDefault.css +0 -117
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeDjango.css +0 -120
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeEclipse.css +0 -128
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeEmacs.css +0 -113
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeFadeToGrey.css +0 -117
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeMDUltra.css +0 -113
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeMidnight.css +0 -113
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeRDark.css +0 -113
- data/guides/assets/stylesheets/syntaxhighlighter/shThemeRailsGuides.css +0 -116
- data/guides/bug_report_templates/action_controller_gem.rb +0 -47
- data/guides/bug_report_templates/action_controller_master.rb +0 -53
- data/guides/bug_report_templates/active_record_gem.rb +0 -40
- data/guides/bug_report_templates/active_record_master.rb +0 -49
- data/guides/bug_report_templates/generic_gem.rb +0 -15
- data/guides/bug_report_templates/generic_master.rb +0 -26
- data/guides/code/getting_started/Gemfile +0 -40
- data/guides/code/getting_started/Gemfile.lock +0 -125
- data/guides/code/getting_started/README.rdoc +0 -28
- data/guides/code/getting_started/Rakefile +0 -6
- data/guides/code/getting_started/app/assets/javascripts/application.js +0 -15
- data/guides/code/getting_started/app/assets/javascripts/comments.js.coffee +0 -3
- data/guides/code/getting_started/app/assets/javascripts/posts.js.coffee +0 -3
- data/guides/code/getting_started/app/assets/javascripts/welcome.js.coffee +0 -3
- data/guides/code/getting_started/app/assets/stylesheets/application.css +0 -13
- data/guides/code/getting_started/app/assets/stylesheets/comments.css.scss +0 -3
- data/guides/code/getting_started/app/assets/stylesheets/posts.css.scss +0 -3
- data/guides/code/getting_started/app/assets/stylesheets/welcome.css.scss +0 -3
- data/guides/code/getting_started/app/controllers/application_controller.rb +0 -5
- data/guides/code/getting_started/app/controllers/comments_controller.rb +0 -23
- data/guides/code/getting_started/app/controllers/posts_controller.rb +0 -53
- data/guides/code/getting_started/app/controllers/welcome_controller.rb +0 -4
- data/guides/code/getting_started/app/helpers/application_helper.rb +0 -2
- data/guides/code/getting_started/app/helpers/comments_helper.rb +0 -2
- data/guides/code/getting_started/app/helpers/posts_helper.rb +0 -2
- data/guides/code/getting_started/app/helpers/welcome_helper.rb +0 -2
- data/guides/code/getting_started/app/models/comment.rb +0 -3
- data/guides/code/getting_started/app/models/post.rb +0 -7
- data/guides/code/getting_started/app/views/comments/_comment.html.erb +0 -15
- data/guides/code/getting_started/app/views/comments/_form.html.erb +0 -13
- data/guides/code/getting_started/app/views/layouts/application.html.erb +0 -14
- data/guides/code/getting_started/app/views/posts/_form.html.erb +0 -27
- data/guides/code/getting_started/app/views/posts/edit.html.erb +0 -5
- data/guides/code/getting_started/app/views/posts/index.html.erb +0 -21
- data/guides/code/getting_started/app/views/posts/new.html.erb +0 -5
- data/guides/code/getting_started/app/views/posts/show.html.erb +0 -18
- data/guides/code/getting_started/app/views/welcome/index.html.erb +0 -4
- data/guides/code/getting_started/bin/bundle +0 -4
- data/guides/code/getting_started/bin/rails +0 -4
- data/guides/code/getting_started/bin/rake +0 -4
- data/guides/code/getting_started/config.ru +0 -4
- data/guides/code/getting_started/config/application.rb +0 -18
- data/guides/code/getting_started/config/boot.rb +0 -4
- data/guides/code/getting_started/config/database.yml +0 -25
- data/guides/code/getting_started/config/environment.rb +0 -5
- data/guides/code/getting_started/config/environments/development.rb +0 -30
- data/guides/code/getting_started/config/environments/production.rb +0 -80
- data/guides/code/getting_started/config/environments/test.rb +0 -36
- data/guides/code/getting_started/config/initializers/backtrace_silencers.rb +0 -7
- data/guides/code/getting_started/config/initializers/filter_parameter_logging.rb +0 -4
- data/guides/code/getting_started/config/initializers/inflections.rb +0 -16
- data/guides/code/getting_started/config/initializers/locale.rb +0 -9
- data/guides/code/getting_started/config/initializers/mime_types.rb +0 -5
- data/guides/code/getting_started/config/initializers/secret_token.rb +0 -12
- data/guides/code/getting_started/config/initializers/session_store.rb +0 -3
- data/guides/code/getting_started/config/initializers/wrap_parameters.rb +0 -14
- data/guides/code/getting_started/config/locales/en.yml +0 -23
- data/guides/code/getting_started/config/routes.rb +0 -7
- data/guides/code/getting_started/db/migrate/20130122042648_create_posts.rb +0 -10
- data/guides/code/getting_started/db/migrate/20130122045842_create_comments.rb +0 -11
- data/guides/code/getting_started/db/schema.rb +0 -33
- data/guides/code/getting_started/db/seeds.rb +0 -7
- data/guides/code/getting_started/public/404.html +0 -60
- data/guides/code/getting_started/public/422.html +0 -60
- data/guides/code/getting_started/public/500.html +0 -59
- data/guides/code/getting_started/public/favicon.ico +0 -0
- data/guides/code/getting_started/public/robots.txt +0 -5
- data/guides/code/getting_started/test/controllers/comments_controller_test.rb +0 -7
- data/guides/code/getting_started/test/controllers/posts_controller_test.rb +0 -7
- data/guides/code/getting_started/test/controllers/welcome_controller_test.rb +0 -9
- data/guides/code/getting_started/test/fixtures/comments.yml +0 -11
- data/guides/code/getting_started/test/fixtures/posts.yml +0 -9
- data/guides/code/getting_started/test/helpers/comments_helper_test.rb +0 -4
- data/guides/code/getting_started/test/helpers/posts_helper_test.rb +0 -4
- data/guides/code/getting_started/test/helpers/welcome_helper_test.rb +0 -4
- data/guides/code/getting_started/test/models/comment_test.rb +0 -7
- data/guides/code/getting_started/test/models/post_test.rb +0 -7
- data/guides/code/getting_started/test/test_helper.rb +0 -12
- data/guides/rails_guides.rb +0 -63
- data/guides/rails_guides/generator.rb +0 -248
- data/guides/rails_guides/helpers.rb +0 -53
- data/guides/rails_guides/indexer.rb +0 -68
- data/guides/rails_guides/kindle.rb +0 -119
- data/guides/rails_guides/levenshtein.rb +0 -31
- data/guides/rails_guides/markdown.rb +0 -163
- data/guides/rails_guides/markdown/renderer.rb +0 -82
- data/guides/source/2_2_release_notes.md +0 -435
- data/guides/source/2_3_release_notes.md +0 -621
- data/guides/source/3_0_release_notes.md +0 -611
- data/guides/source/3_1_release_notes.md +0 -556
- data/guides/source/3_2_release_notes.md +0 -565
- data/guides/source/4_0_release_notes.md +0 -276
- data/guides/source/4_1_release_notes.md +0 -731
- data/guides/source/_license.html.erb +0 -2
- data/guides/source/_welcome.html.erb +0 -25
- data/guides/source/action_controller_overview.md +0 -1175
- data/guides/source/action_mailer_basics.md +0 -689
- data/guides/source/action_view_overview.md +0 -1602
- data/guides/source/active_model_basics.md +0 -200
- data/guides/source/active_record_basics.md +0 -373
- data/guides/source/active_record_callbacks.md +0 -410
- data/guides/source/active_record_querying.md +0 -1785
- data/guides/source/active_record_validations.md +0 -1169
- data/guides/source/active_support_core_extensions.md +0 -3817
- data/guides/source/active_support_instrumentation.md +0 -496
- data/guides/source/api_documentation_guidelines.md +0 -315
- data/guides/source/asset_pipeline.md +0 -1165
- data/guides/source/association_basics.md +0 -2229
- data/guides/source/caching_with_rails.md +0 -354
- data/guides/source/command_line.md +0 -603
- data/guides/source/configuring.md +0 -942
- data/guides/source/contributing_to_ruby_on_rails.md +0 -544
- data/guides/source/credits.html.erb +0 -80
- data/guides/source/debugging_rails_applications.md +0 -707
- data/guides/source/development_dependencies_install.md +0 -278
- data/guides/source/documents.yaml +0 -193
- data/guides/source/engines.md +0 -1412
- data/guides/source/form_helpers.md +0 -1001
- data/guides/source/generators.md +0 -663
- data/guides/source/getting_started.md +0 -1946
- data/guides/source/i18n.md +0 -1043
- data/guides/source/index.html.erb +0 -27
- data/guides/source/initialization.md +0 -657
- data/guides/source/kindle/copyright.html.erb +0 -1
- data/guides/source/kindle/layout.html.erb +0 -27
- data/guides/source/kindle/rails_guides.opf.erb +0 -52
- data/guides/source/kindle/toc.html.erb +0 -24
- data/guides/source/kindle/toc.ncx.erb +0 -64
- data/guides/source/kindle/welcome.html.erb +0 -5
- data/guides/source/layout.html.erb +0 -146
- data/guides/source/layouts_and_rendering.md +0 -1226
- data/guides/source/maintenance_policy.md +0 -75
- data/guides/source/migrations.md +0 -1143
- data/guides/source/nested_model_forms.md +0 -225
- data/guides/source/plugins.md +0 -444
- data/guides/source/rails_application_templates.md +0 -248
- data/guides/source/rails_on_rack.md +0 -332
- data/guides/source/routing.md +0 -1115
- data/guides/source/ruby_on_rails_guides_guidelines.md +0 -128
- data/guides/source/security.md +0 -1018
- data/guides/source/testing.md +0 -1052
- data/guides/source/upgrading_ruby_on_rails.md +0 -928
- data/guides/source/working_with_javascript_in_rails.md +0 -405
- data/guides/w3c_validator.rb +0 -95
@@ -1,276 +0,0 @@
|
|
1
|
-
Ruby on Rails 4.0 Release Notes
|
2
|
-
===============================
|
3
|
-
|
4
|
-
Highlights in Rails 4.0:
|
5
|
-
|
6
|
-
* Ruby 2.0 preferred; 1.9.3+ required
|
7
|
-
* Strong Parameters
|
8
|
-
* Turbolinks
|
9
|
-
* Russian Doll Caching
|
10
|
-
|
11
|
-
These release notes cover only the major changes. To know about various bug fixes and changes, please refer to the change logs or 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 4.0
|
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.2 in case you haven't and make sure your application still runs as expected before attempting an update to Rails 4.0. A list of things to watch out for when upgrading is available in the [Upgrading Ruby on Rails](upgrading_ruby_on_rails.html#upgrading-from-rails-3-2-to-rails-4-0) guide.
|
19
|
-
|
20
|
-
|
21
|
-
Creating a Rails 4.0 application
|
22
|
-
--------------------------------
|
23
|
-
|
24
|
-
```
|
25
|
-
You should have the 'rails' RubyGem installed
|
26
|
-
$ rails new myapp
|
27
|
-
$ cd myapp
|
28
|
-
```
|
29
|
-
|
30
|
-
### Vendoring Gems
|
31
|
-
|
32
|
-
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.
|
33
|
-
|
34
|
-
More information: [Bundler homepage](http://gembundler.com)
|
35
|
-
|
36
|
-
### Living on the Edge
|
37
|
-
|
38
|
-
`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:
|
39
|
-
|
40
|
-
```
|
41
|
-
$ rails new myapp --edge
|
42
|
-
```
|
43
|
-
|
44
|
-
If you have a local checkout of the Rails repository and want to generate an application using that, you can pass the `--dev` flag:
|
45
|
-
|
46
|
-
```
|
47
|
-
$ ruby /path/to/rails/railties/bin/rails new myapp --dev
|
48
|
-
```
|
49
|
-
|
50
|
-
Major Features
|
51
|
-
--------------
|
52
|
-
|
53
|
-
[![Rails 4.0](images/rails4_features.png)](http://guides.rubyonrails.org/images/rails4_features.png)
|
54
|
-
|
55
|
-
### Upgrade
|
56
|
-
|
57
|
-
* **Ruby 1.9.3** ([commit](https://github.com/rails/rails/commit/a0380e808d3dbd2462df17f5d3b7fcd8bd812496)) - Ruby 2.0 preferred; 1.9.3+ required
|
58
|
-
* **[New deprecation policy](http://www.youtube.com/watch?v=z6YgD6tVPQs)** - Deprecated features are warnings in Rails 4.0 and will be removed in Rails 4.1.
|
59
|
-
* **ActionPack page and action caching** ([commit](https://github.com/rails/rails/commit/b0a7068564f0c95e7ef28fc39d0335ed17d93e90)) - Page and action caching are extracted to a separate gem. Page and action caching requires too much manual intervention (manually expiring caches when the underlying model objects are updated). Instead, use Russian doll caching.
|
60
|
-
* **ActiveRecord observers** ([commit](https://github.com/rails/rails/commit/ccecab3ba950a288b61a516bf9b6962e384aae0b)) - Observers are extracted to a separate gem. Observers are only needed for page and action caching, and can lead to spaghetti code.
|
61
|
-
* **ActiveRecord session store** ([commit](https://github.com/rails/rails/commit/0ffe19056c8e8b2f9ae9d487b896cad2ce9387ad)) - The ActiveRecord session store is extracted to a separate gem. Storing sessions in SQL is costly. Instead, use cookie sessions, memcache sessions, or a custom session store.
|
62
|
-
* **ActiveModel mass assignment protection** ([commit](https://github.com/rails/rails/commit/f8c9a4d3e88181cee644f91e1342bfe896ca64c6)) - Rails 3 mass assignment protection is deprecated. Instead, use strong parameters.
|
63
|
-
* **ActiveResource** ([commit](https://github.com/rails/rails/commit/f1637bf2bb00490203503fbd943b73406e043d1d)) - ActiveResource is extracted to a separate gem. ActiveResource was not widely used.
|
64
|
-
* **vendor/plugins removed** ([commit](https://github.com/rails/rails/commit/853de2bd9ac572735fa6cf59fcf827e485a231c3)) - Use a Gemfile to manage installed gems.
|
65
|
-
|
66
|
-
### ActionPack
|
67
|
-
|
68
|
-
* **Strong parameters** ([commit](https://github.com/rails/rails/commit/a8f6d5c6450a7fe058348a7f10a908352bb6c7fc)) - Only allow whitelisted parameters to update model objects (`params.permit(:title, :text)`).
|
69
|
-
* **Routing concerns** ([commit](https://github.com/rails/rails/commit/0dd24728a088fcb4ae616bb5d62734aca5276b1b)) - In the routing DSL, factor out common subroutes (`comments` from `/posts/1/comments` and `/videos/1/comments`).
|
70
|
-
* **ActionController::Live** ([commit](https://github.com/rails/rails/commit/af0a9f9eefaee3a8120cfd8d05cbc431af376da3)) - Stream JSON with `response.stream`.
|
71
|
-
* **Declarative ETags** ([commit](https://github.com/rails/rails/commit/ed5c938fa36995f06d4917d9543ba78ed506bb8d)) - Add controller-level etag additions that will be part of the action etag computation
|
72
|
-
* **[Russian doll caching](http://37signals.com/svn/posts/3113-how-key-based-cache-expiration-works)** ([commit](https://github.com/rails/rails/commit/4154bf012d2bec2aae79e4a49aa94a70d3e91d49)) - Cache nested fragments of views. Each fragment expires based on a set of dependencies (a cache key). The cache key is usually a template version number and a model object.
|
73
|
-
* **Turbolinks** ([commit](https://github.com/rails/rails/commit/e35d8b18d0649c0ecc58f6b73df6b3c8d0c6bb74)) - Serve only one initial HTML page. When the user navigates to another page, use pushState to update the URL and use AJAX to update the title and body.
|
74
|
-
* **Decouple ActionView from ActionController** ([commit](https://github.com/rails/rails/commit/78b0934dd1bb84e8f093fb8ef95ca99b297b51cd)) - ActionView was decoupled from ActionPack and will be moved to a separated gem in Rails 4.1.
|
75
|
-
* **Do not depend on ActiveModel** ([commit](https://github.com/rails/rails/commit/166dbaa7526a96fdf046f093f25b0a134b277a68)) - ActionPack no longer depends on ActiveModel.
|
76
|
-
|
77
|
-
### General
|
78
|
-
|
79
|
-
* **ActiveModel::Model** ([commit](https://github.com/rails/rails/commit/3b822e91d1a6c4eab0064989bbd07aae3a6d0d08)) - `ActiveModel::Model`, a mixin to make normal Ruby objects to work with ActionPack out of box (ex. for `form_for`)
|
80
|
-
* **New scope API** ([commit](https://github.com/rails/rails/commit/50cbc03d18c5984347965a94027879623fc44cce)) - Scopes must always use callables.
|
81
|
-
* **Schema cache dump** ([commit](https://github.com/rails/rails/commit/5ca4fc95818047108e69e22d200e7a4a22969477)) - To improve Rails boot time, instead of loading the schema directly from the database, load the schema from a dump file.
|
82
|
-
* **Support for specifying transaction isolation level** ([commit](https://github.com/rails/rails/commit/392eeecc11a291e406db927a18b75f41b2658253)) - Choose whether repeatable reads or improved performance (less locking) is more important.
|
83
|
-
* **Dalli** ([commit](https://github.com/rails/rails/commit/82663306f428a5bbc90c511458432afb26d2f238)) - Use Dalli memcache client for the memcache store.
|
84
|
-
* **Notifications start & finish** ([commit](https://github.com/rails/rails/commit/f08f8750a512f741acb004d0cebe210c5f949f28)) - Active Support instrumentation reports start and finish notifications to subscribers.
|
85
|
-
* **Thread safe by default** ([commit](https://github.com/rails/rails/commit/5d416b907864d99af55ebaa400fff217e17570cd)) - Rails can run in threaded app servers without additional configuration. Note: Check that the gems you are using are threadsafe.
|
86
|
-
* **PATCH verb** ([commit](https://github.com/rails/rails/commit/eed9f2539e3ab5a68e798802f464b8e4e95e619e)) - In Rails, PATCH replaces PUT. PATCH is used for partial updates of resources.
|
87
|
-
|
88
|
-
### Security
|
89
|
-
|
90
|
-
* **match do not catch all** ([commit](https://github.com/rails/rails/commit/90d2802b71a6e89aedfe40564a37bd35f777e541)) - In the routing DSL, match requires the HTTP verb or verbs to be specified.
|
91
|
-
* **html entities escaped by default** ([commit](https://github.com/rails/rails/commit/5f189f41258b83d49012ec5a0678d827327e7543)) - Strings rendered in erb are escaped unless wrapped with `raw` or `html_safe` is called.
|
92
|
-
* **New security headers** ([commit](https://github.com/rails/rails/commit/6794e92b204572d75a07bd6413bdae6ae22d5a82)) - Rails sends the following headers with every HTTP request: `X-Frame-Options` (prevents clickjacking by forbidding the browser from embedding the page in a frame), `X-XSS-Protection` (asks the browser to halt script injection) and `X-Content-Type-Options` (prevents the browser from opening a jpeg as an exe).
|
93
|
-
|
94
|
-
Extraction of features to gems
|
95
|
-
---------------------------
|
96
|
-
|
97
|
-
In Rails 4.0, several features have been extracted into gems. You can simply add the extracted gems to your `Gemfile` to bring the functionality back.
|
98
|
-
|
99
|
-
* Hash-based & Dynamic finder methods ([GitHub](https://github.com/rails/activerecord-deprecated_finders))
|
100
|
-
* Mass assignment protection in Active Record models ([GitHub](https://github.com/rails/protected_attributes), [Pull Request](https://github.com/rails/rails/pull/7251))
|
101
|
-
* ActiveRecord::SessionStore ([GitHub](https://github.com/rails/activerecord-session_store), [Pull Request](https://github.com/rails/rails/pull/7436))
|
102
|
-
* Active Record Observers ([GitHub](https://github.com/rails/rails-observers), [Commit](https://github.com/rails/rails/commit/39e85b3b90c58449164673909a6f1893cba290b2))
|
103
|
-
* Active Resource ([GitHub](https://github.com/rails/activeresource), [Pull Request](https://github.com/rails/rails/pull/572), [Blog](http://yetimedia.tumblr.com/post/35233051627/activeresource-is-dead-long-live-activeresource))
|
104
|
-
* Action Caching ([GitHub](https://github.com/rails/actionpack-action_caching), [Pull Request](https://github.com/rails/rails/pull/7833))
|
105
|
-
* Page Caching ([GitHub](https://github.com/rails/actionpack-page_caching), [Pull Request](https://github.com/rails/rails/pull/7833))
|
106
|
-
* Sprockets ([GitHub](https://github.com/rails/sprockets-rails))
|
107
|
-
* Performance tests ([GitHub](https://github.com/rails/rails-perftest), [Pull Request](https://github.com/rails/rails/pull/8876))
|
108
|
-
|
109
|
-
Documentation
|
110
|
-
-------------
|
111
|
-
|
112
|
-
* Guides are rewritten in GitHub Flavored Markdown.
|
113
|
-
|
114
|
-
* Guides have a responsive design.
|
115
|
-
|
116
|
-
Railties
|
117
|
-
--------
|
118
|
-
|
119
|
-
Please refer to the [Changelog](https://github.com/rails/rails/blob/4-0-stable/railties/CHANGELOG.md) for detailed changes.
|
120
|
-
|
121
|
-
### Notable changes
|
122
|
-
|
123
|
-
* New test locations `test/models`, `test/helpers`, `test/controllers`, and `test/mailers`. Corresponding rake tasks added as well. ([Pull Request](https://github.com/rails/rails/pull/7878))
|
124
|
-
|
125
|
-
* Your app's executables now live in the `bin/` directory. Run `rake rails:update:bin` to get `bin/bundle`, `bin/rails`, and `bin/rake`.
|
126
|
-
|
127
|
-
* Threadsafe on by default
|
128
|
-
|
129
|
-
* Ability to use a custom builder by passing `--builder` (or `-b`) to
|
130
|
-
`rails new` has been removed. Consider using application templates
|
131
|
-
instead. ([Pull Request](https://github.com/rails/rails/pull/9401))
|
132
|
-
|
133
|
-
### Deprecations
|
134
|
-
|
135
|
-
* `config.threadsafe!` is deprecated in favor of `config.eager_load` which provides a more fine grained control on what is eager loaded.
|
136
|
-
|
137
|
-
* `Rails::Plugin` has gone. Instead of adding plugins to `vendor/plugins` use gems or bundler with path or git dependencies.
|
138
|
-
|
139
|
-
Action Mailer
|
140
|
-
-------------
|
141
|
-
|
142
|
-
Please refer to the [Changelog](https://github.com/rails/rails/blob/4-0-stable/actionmailer/CHANGELOG.md) for detailed changes.
|
143
|
-
|
144
|
-
### Notable changes
|
145
|
-
|
146
|
-
### Deprecations
|
147
|
-
|
148
|
-
Active Model
|
149
|
-
------------
|
150
|
-
|
151
|
-
Please refer to the [Changelog](https://github.com/rails/rails/blob/4-0-stable/activemodel/CHANGELOG.md) for detailed changes.
|
152
|
-
|
153
|
-
### Notable changes
|
154
|
-
|
155
|
-
* Add `ActiveModel::ForbiddenAttributesProtection`, a simple module to protect attributes from mass assignment when non-permitted attributes are passed.
|
156
|
-
|
157
|
-
* Added `ActiveModel::Model`, a mixin to make Ruby objects work with Action Pack out of box.
|
158
|
-
|
159
|
-
### Deprecations
|
160
|
-
|
161
|
-
Active Support
|
162
|
-
--------------
|
163
|
-
|
164
|
-
Please refer to the [Changelog](https://github.com/rails/rails/blob/4-0-stable/activesupport/CHANGELOG.md) for detailed changes.
|
165
|
-
|
166
|
-
### Notable changes
|
167
|
-
|
168
|
-
* Replace deprecated `memcache-client` gem with `dalli` in `ActiveSupport::Cache::MemCacheStore`.
|
169
|
-
|
170
|
-
* Optimize `ActiveSupport::Cache::Entry` to reduce memory and processing overhead.
|
171
|
-
|
172
|
-
* Inflections can now be defined per locale. `singularize` and `pluralize` accept locale as an extra argument.
|
173
|
-
|
174
|
-
* `Object#try` will now return nil instead of raise a NoMethodError if the receiving object does not implement the method, but you can still get the old behavior by using the new `Object#try!`.
|
175
|
-
|
176
|
-
* `String#to_date` now raises `ArgumentError: invalid date` instead of `NoMethodError: undefined method 'div' for nil:NilClass`
|
177
|
-
when given an invalid date. It is now the same as `Date.parse`, and it accepts more invalid dates than 3.x, such as:
|
178
|
-
|
179
|
-
```
|
180
|
-
# ActiveSupport 3.x
|
181
|
-
"asdf".to_date # => NoMethodError: undefined method `div' for nil:NilClass
|
182
|
-
"333".to_date # => NoMethodError: undefined method `div' for nil:NilClass
|
183
|
-
|
184
|
-
# ActiveSupport 4
|
185
|
-
"asdf".to_date # => ArgumentError: invalid date
|
186
|
-
"333".to_date # => Fri, 29 Nov 2013
|
187
|
-
```
|
188
|
-
|
189
|
-
### Deprecations
|
190
|
-
|
191
|
-
* Deprecate `ActiveSupport::TestCase#pending` method, use `skip` from MiniTest instead.
|
192
|
-
|
193
|
-
* `ActiveSupport::Benchmarkable#silence` has been deprecated due to its lack of thread safety. It will be removed without replacement in Rails 4.1.
|
194
|
-
|
195
|
-
* `ActiveSupport::JSON::Variable` is deprecated. Define your own `#as_json` and `#encode_json` methods for custom JSON string literals.
|
196
|
-
|
197
|
-
* Deprecates the compatibility method `Module#local_constant_names`, use `Module#local_constants` instead (which returns symbols).
|
198
|
-
|
199
|
-
* `BufferedLogger` is deprecated. Use `ActiveSupport::Logger`, or the logger from Ruby standard library.
|
200
|
-
|
201
|
-
* Deprecate `assert_present` and `assert_blank` in favor of `assert object.blank?` and `assert object.present?`
|
202
|
-
|
203
|
-
Action Pack
|
204
|
-
-----------
|
205
|
-
|
206
|
-
Please refer to the [Changelog](https://github.com/rails/rails/blob/4-0-stable/actionpack/CHANGELOG.md) for detailed changes.
|
207
|
-
|
208
|
-
### Notable changes
|
209
|
-
|
210
|
-
* Change the stylesheet of exception pages for development mode. Additionally display also the line of code and fragment that raised the exception in all exceptions pages.
|
211
|
-
|
212
|
-
### Deprecations
|
213
|
-
|
214
|
-
|
215
|
-
Active Record
|
216
|
-
-------------
|
217
|
-
|
218
|
-
Please refer to the [Changelog](https://github.com/rails/rails/blob/4-0-stable/activerecord/CHANGELOG.md) for detailed changes.
|
219
|
-
|
220
|
-
### Notable changes
|
221
|
-
|
222
|
-
* Improve ways to write `change` migrations, making the old `up` & `down` methods no longer necessary.
|
223
|
-
|
224
|
-
* The methods `drop_table` and `remove_column` are now reversible, as long as the necessary information is given.
|
225
|
-
The method `remove_column` used to accept multiple column names; instead use `remove_columns` (which is not revertible).
|
226
|
-
The method `change_table` is also reversible, as long as its block doesn't call `remove`, `change` or `change_default`
|
227
|
-
|
228
|
-
* New method `reversible` makes it possible to specify code to be run when migrating up or down.
|
229
|
-
See the [Guide on Migration](https://github.com/rails/rails/blob/master/guides/source/migrations.md#using-the-reversible-method)
|
230
|
-
|
231
|
-
* New method `revert` will revert a whole migration or the given block.
|
232
|
-
If migrating down, the given migration / block is run normally.
|
233
|
-
See the [Guide on Migration](https://github.com/rails/rails/blob/master/guides/source/migrations.md#reverting-previous-migrations)
|
234
|
-
|
235
|
-
* Adds PostgreSQL array type support. Any datatype can be used to create an array column, with full migration and schema dumper support.
|
236
|
-
|
237
|
-
* Add `Relation#load` to explicitly load the record and return `self`.
|
238
|
-
|
239
|
-
* `Model.all` now returns an `ActiveRecord::Relation`, rather than an array of records. Use `Relation#to_a` if you really want an array. In some specific cases, this may cause breakage when upgrading.
|
240
|
-
|
241
|
-
* Added `ActiveRecord::Migration.check_pending!` that raises an error if migrations are pending.
|
242
|
-
|
243
|
-
* Added custom coders support for `ActiveRecord::Store`. Now you can set your custom coder like this:
|
244
|
-
|
245
|
-
store :settings, accessors: [ :color, :homepage ], coder: JSON
|
246
|
-
|
247
|
-
* `mysql` and `mysql2` connections will set `SQL_MODE=STRICT_ALL_TABLES` by default to avoid silent data loss. This can be disabled by specifying `strict: false` in your `database.yml`.
|
248
|
-
|
249
|
-
* Remove IdentityMap.
|
250
|
-
|
251
|
-
* Remove automatic execution of EXPLAIN queries. The option `active_record.auto_explain_threshold_in_seconds` is no longer used and should be removed.
|
252
|
-
|
253
|
-
* Adds `ActiveRecord::NullRelation` and `ActiveRecord::Relation#none` implementing the null object pattern for the Relation class.
|
254
|
-
|
255
|
-
* Added `create_join_table` migration helper to create HABTM join tables.
|
256
|
-
|
257
|
-
* Allows PostgreSQL hstore records to be created.
|
258
|
-
|
259
|
-
### Deprecations
|
260
|
-
|
261
|
-
* Deprecated the old-style hash based finder API. This means that methods which previously accepted "finder options" no longer do.
|
262
|
-
|
263
|
-
* All dynamic methods except for `find_by_...` and `find_by_...!` are deprecated. Here's
|
264
|
-
how you can rewrite the code:
|
265
|
-
|
266
|
-
* `find_all_by_...` can be rewritten using `where(...)`.
|
267
|
-
* `find_last_by_...` can be rewritten using `where(...).last`.
|
268
|
-
* `scoped_by_...` can be rewritten using `where(...)`.
|
269
|
-
* `find_or_initialize_by_...` can be rewritten using `find_or_initialize_by(...)`.
|
270
|
-
* `find_or_create_by_...` can be rewritten using `find_or_create_by(...)`.
|
271
|
-
* `find_or_create_by_...!` can be rewritten using `find_or_create_by!(...)`.
|
272
|
-
|
273
|
-
Credits
|
274
|
-
-------
|
275
|
-
|
276
|
-
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.
|
@@ -1,731 +0,0 @@
|
|
1
|
-
Ruby on Rails 4.1 Release Notes
|
2
|
-
===============================
|
3
|
-
|
4
|
-
Highlights in Rails 4.1:
|
5
|
-
|
6
|
-
* Spring application preloader
|
7
|
-
* `config/secrets.yml`
|
8
|
-
* Action Pack variants
|
9
|
-
* Action Mailer previews
|
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/4-1-stable) in the main Rails
|
14
|
-
repository on GitHub.
|
15
|
-
|
16
|
-
--------------------------------------------------------------------------------
|
17
|
-
|
18
|
-
Upgrading to Rails 4.1
|
19
|
-
----------------------
|
20
|
-
|
21
|
-
If you're upgrading an existing application, it's a great idea to have good test
|
22
|
-
coverage before going in. You should also first upgrade to Rails 4.0 in case you
|
23
|
-
haven't and make sure your application still runs as expected before attempting
|
24
|
-
an update to Rails 4.1. A list of things to watch out for when upgrading is
|
25
|
-
available in the
|
26
|
-
[Upgrading Ruby on Rails](upgrading_ruby_on_rails.html#upgrading-from-rails-4-0-to-rails-4-1)
|
27
|
-
guide.
|
28
|
-
|
29
|
-
|
30
|
-
Major Features
|
31
|
-
--------------
|
32
|
-
|
33
|
-
### Spring Application Preloader
|
34
|
-
|
35
|
-
Spring is a Rails application preloader. It speeds up development by keeping
|
36
|
-
your application running in the background so you don't need to boot it every
|
37
|
-
time you run a test, rake task or migration.
|
38
|
-
|
39
|
-
New Rails 4.1 applications will ship with "springified" binstubs. This means
|
40
|
-
that `bin/rails` and `bin/rake` will automatically take advantage of preloaded
|
41
|
-
spring environments.
|
42
|
-
|
43
|
-
**Running rake tasks:**
|
44
|
-
|
45
|
-
```
|
46
|
-
bin/rake test:models
|
47
|
-
```
|
48
|
-
|
49
|
-
**Running a Rails command:**
|
50
|
-
|
51
|
-
```
|
52
|
-
bin/rails console
|
53
|
-
```
|
54
|
-
|
55
|
-
**Spring introspection:**
|
56
|
-
|
57
|
-
```
|
58
|
-
$ bin/spring status
|
59
|
-
Spring is running:
|
60
|
-
|
61
|
-
1182 spring server | my_app | started 29 mins ago
|
62
|
-
3656 spring app | my_app | started 23 secs ago | test mode
|
63
|
-
3746 spring app | my_app | started 10 secs ago | development mode
|
64
|
-
```
|
65
|
-
|
66
|
-
Have a look at the
|
67
|
-
[Spring README](https://github.com/rails/spring/blob/master/README.md) to
|
68
|
-
see all available features.
|
69
|
-
|
70
|
-
See the [Upgrading Ruby on Rails](upgrading_ruby_on_rails.html#spring)
|
71
|
-
guide on how to migrate existing applications to use this feature.
|
72
|
-
|
73
|
-
### `config/secrets.yml`
|
74
|
-
|
75
|
-
Rails 4.1 generates a new `secrets.yml` file in the `config` folder. By default,
|
76
|
-
this file contains the application's `secret_key_base`, but it could also be
|
77
|
-
used to store other secrets such as access keys for external APIs.
|
78
|
-
|
79
|
-
The secrets added to this file are accessible via `Rails.application.secrets`.
|
80
|
-
For example, with the following `config/secrets.yml`:
|
81
|
-
|
82
|
-
```yaml
|
83
|
-
development:
|
84
|
-
secret_key_base: 3b7cd727ee24e8444053437c36cc66c3
|
85
|
-
some_api_key: SOMEKEY
|
86
|
-
```
|
87
|
-
|
88
|
-
`Rails.application.secrets.some_api_key` returns `SOMEKEY` in the development
|
89
|
-
environment.
|
90
|
-
|
91
|
-
See the [Upgrading Ruby on Rails](upgrading_ruby_on_rails.html#config-secrets-yml)
|
92
|
-
guide on how to migrate existing applications to use this feature.
|
93
|
-
|
94
|
-
### Action Pack Variants
|
95
|
-
|
96
|
-
We often want to render different HTML/JSON/XML templates for phones,
|
97
|
-
tablets, and desktop browsers. Variants make it easy.
|
98
|
-
|
99
|
-
The request variant is a specialization of the request format, like `:tablet`,
|
100
|
-
`:phone`, or `:desktop`.
|
101
|
-
|
102
|
-
You can set the variant in a `before_action`:
|
103
|
-
|
104
|
-
```ruby
|
105
|
-
request.variant = :tablet if request.user_agent =~ /iPad/
|
106
|
-
```
|
107
|
-
|
108
|
-
Respond to variants in the action just like you respond to formats:
|
109
|
-
|
110
|
-
```ruby
|
111
|
-
respond_to do |format|
|
112
|
-
format.html do |html|
|
113
|
-
html.tablet # renders app/views/projects/show.html+tablet.erb
|
114
|
-
html.phone { extra_setup; render ... }
|
115
|
-
end
|
116
|
-
end
|
117
|
-
```
|
118
|
-
|
119
|
-
Provide separate templates for each format and variant:
|
120
|
-
|
121
|
-
```
|
122
|
-
app/views/projects/show.html.erb
|
123
|
-
app/views/projects/show.html+tablet.erb
|
124
|
-
app/views/projects/show.html+phone.erb
|
125
|
-
```
|
126
|
-
|
127
|
-
You can also simplify the variants definition using the inline syntax:
|
128
|
-
|
129
|
-
```ruby
|
130
|
-
respond_to do |format|
|
131
|
-
format.js { render "trash" }
|
132
|
-
format.html.phone { redirect_to progress_path }
|
133
|
-
format.html.none { render "trash" }
|
134
|
-
end
|
135
|
-
```
|
136
|
-
|
137
|
-
### Action Mailer Previews
|
138
|
-
|
139
|
-
Action Mailer previews provide a way to visually see how emails look by visiting
|
140
|
-
a special URL that renders them.
|
141
|
-
|
142
|
-
You implement a preview class whose methods return the mail object you'd like
|
143
|
-
to check:
|
144
|
-
|
145
|
-
```ruby
|
146
|
-
class NotifierPreview < ActionMailer::Preview
|
147
|
-
def welcome
|
148
|
-
Notifier.welcome(User.first)
|
149
|
-
end
|
150
|
-
end
|
151
|
-
```
|
152
|
-
|
153
|
-
The preview is available in http://localhost:3000/rails/mailers/notifier/welcome,
|
154
|
-
and a list of them in http://localhost:3000/rails/mailers.
|
155
|
-
|
156
|
-
By default, these preview classes live in `test/mailers/previews`.
|
157
|
-
This can be configured using the `preview_path` option.
|
158
|
-
|
159
|
-
See its
|
160
|
-
[documentation](http://api.rubyonrails.org/v4.1.0/classes/ActionMailer/Base.html#class-ActionMailer::Base-label-Previewing+emails)
|
161
|
-
for a detailed write up.
|
162
|
-
|
163
|
-
### Active Record enums
|
164
|
-
|
165
|
-
Declare an enum attribute where the values map to integers in the database, but
|
166
|
-
can be queried by name.
|
167
|
-
|
168
|
-
```ruby
|
169
|
-
class Conversation < ActiveRecord::Base
|
170
|
-
enum status: [ :active, :archived ]
|
171
|
-
end
|
172
|
-
|
173
|
-
conversation.archived!
|
174
|
-
conversation.active? # => false
|
175
|
-
conversation.status # => "archived"
|
176
|
-
|
177
|
-
Conversation.archived # => Relation for all archived Conversations
|
178
|
-
|
179
|
-
Conversation.statuses # => { "active" => 0, "archived" => 1 }
|
180
|
-
```
|
181
|
-
|
182
|
-
See its
|
183
|
-
[documentation](http://api.rubyonrails.org/v4.1.0/classes/ActiveRecord/Enum.html)
|
184
|
-
for a detailed write up.
|
185
|
-
|
186
|
-
### Message Verifiers
|
187
|
-
|
188
|
-
Message verifiers can be used to generate and verify signed messages. This can
|
189
|
-
be useful to safely transport sensitive data like remember-me tokens and
|
190
|
-
friends.
|
191
|
-
|
192
|
-
The method `Rails.application.message_verifier` returns a new message verifier
|
193
|
-
that signs messages with a key derived from secret_key_base and the given
|
194
|
-
message verifier name:
|
195
|
-
|
196
|
-
```ruby
|
197
|
-
signed_token = Rails.application.message_verifier(:remember_me).generate(token)
|
198
|
-
Rails.application.message_verifier(:remember_me).verify(signed_token) # => token
|
199
|
-
|
200
|
-
Rails.application.message_verifier(:remember_me).verify(tampered_token)
|
201
|
-
# raises ActiveSupport::MessageVerifier::InvalidSignature
|
202
|
-
```
|
203
|
-
|
204
|
-
### Module#concerning
|
205
|
-
|
206
|
-
A natural, low-ceremony way to separate responsibilities within a class:
|
207
|
-
|
208
|
-
```ruby
|
209
|
-
class Todo < ActiveRecord::Base
|
210
|
-
concerning :EventTracking do
|
211
|
-
included do
|
212
|
-
has_many :events
|
213
|
-
end
|
214
|
-
|
215
|
-
def latest_event
|
216
|
-
...
|
217
|
-
end
|
218
|
-
|
219
|
-
private
|
220
|
-
def some_internal_method
|
221
|
-
...
|
222
|
-
end
|
223
|
-
end
|
224
|
-
end
|
225
|
-
```
|
226
|
-
|
227
|
-
This example is equivalent to defining a `EventTracking` module inline,
|
228
|
-
extending it with `ActiveSupport::Concern`, then mixing it in to the
|
229
|
-
`Todo` class.
|
230
|
-
|
231
|
-
See its
|
232
|
-
[documentation](http://api.rubyonrails.org/v4.1.0/classes/Module/Concerning.html)
|
233
|
-
for a detailed write up and the intended use cases.
|
234
|
-
|
235
|
-
### CSRF protection from remote `<script>` tags
|
236
|
-
|
237
|
-
Cross-site request forgery (CSRF) protection now covers GET requests with
|
238
|
-
JavaScript responses, too. That prevents a third-party site from referencing
|
239
|
-
your JavaScript URL and attempting to run it to extract sensitive data.
|
240
|
-
|
241
|
-
This means any of your tests that hit `.js` URLs will now fail CSRF protection
|
242
|
-
unless they use `xhr`. Upgrade your tests to be explicit about expecting
|
243
|
-
XmlHttpRequests. Instead of `post :create, format: :js`, switch to the explicit
|
244
|
-
`xhr :post, :create, format: :js`.
|
245
|
-
|
246
|
-
|
247
|
-
Railties
|
248
|
-
--------
|
249
|
-
|
250
|
-
Please refer to the
|
251
|
-
[Changelog](https://github.com/rails/rails/blob/4-1-stable/railties/CHANGELOG.md)
|
252
|
-
for detailed changes.
|
253
|
-
|
254
|
-
### Removals
|
255
|
-
|
256
|
-
* Removed `update:application_controller` rake task.
|
257
|
-
|
258
|
-
* Removed deprecated `Rails.application.railties.engines`.
|
259
|
-
|
260
|
-
* Removed deprecated `threadsafe!` from Rails Config.
|
261
|
-
|
262
|
-
* Removed deprecated `ActiveRecord::Generators::ActiveModel#update_attributes` in
|
263
|
-
favor of `ActiveRecord::Generators::ActiveModel#update`.
|
264
|
-
|
265
|
-
* Removed deprecated `config.whiny_nils` option.
|
266
|
-
|
267
|
-
* Removed deprecated rake tasks for running tests: `rake test:uncommitted` and
|
268
|
-
`rake test:recent`.
|
269
|
-
|
270
|
-
### Notable changes
|
271
|
-
|
272
|
-
* The [Spring application
|
273
|
-
preloader](https://github.com/rails/spring) is now installed
|
274
|
-
by default for new applications. It uses the development group of
|
275
|
-
the Gemfile, so will not be installed in
|
276
|
-
production. ([Pull Request](https://github.com/rails/rails/pull/12958))
|
277
|
-
|
278
|
-
* `BACKTRACE` environment variable to show unfiltered backtraces for test
|
279
|
-
failures. ([Commit](https://github.com/rails/rails/commit/84eac5dab8b0fe9ee20b51250e52ad7bfea36553))
|
280
|
-
|
281
|
-
* Exposed `MiddlewareStack#unshift` to environment
|
282
|
-
configuration. ([Pull Request](https://github.com/rails/rails/pull/12479))
|
283
|
-
|
284
|
-
* Added `Application#message_verifier` method to return a message
|
285
|
-
verifier. ([Pull Request](https://github.com/rails/rails/pull/12995))
|
286
|
-
|
287
|
-
* The `test_help.rb` file which is required by the default generated test
|
288
|
-
helper will automatically keep your test database up-to-date with
|
289
|
-
`db/schema.rb` (or `db/structure.sql`). It raises an error if
|
290
|
-
reloading the schema does not resolve all pending migrations. Opt out
|
291
|
-
with `config.active_record.maintain_test_schema = false`. ([Pull
|
292
|
-
Request](https://github.com/rails/rails/pull/13528))
|
293
|
-
|
294
|
-
* Introduce `Rails.gem_version` as a convenience method to return
|
295
|
-
`Gem::Version.new(Rails.version)`, suggesting a more reliable way to perform
|
296
|
-
version comparison. ([Pull Request](https://github.com/rails/rails/pull/14103))
|
297
|
-
|
298
|
-
|
299
|
-
Action Pack
|
300
|
-
-----------
|
301
|
-
|
302
|
-
Please refer to the
|
303
|
-
[Changelog](https://github.com/rails/rails/blob/4-1-stable/actionpack/CHANGELOG.md)
|
304
|
-
for detailed changes.
|
305
|
-
|
306
|
-
### Removals
|
307
|
-
|
308
|
-
* Removed deprecated Rails application fallback for integration testing, set
|
309
|
-
`ActionDispatch.test_app` instead.
|
310
|
-
|
311
|
-
* Removed deprecated `page_cache_extension` config.
|
312
|
-
|
313
|
-
* Removed deprecated `ActionController::RecordIdentifier`, use
|
314
|
-
`ActionView::RecordIdentifier` instead.
|
315
|
-
|
316
|
-
* Removed deprecated constants from Action Controller:
|
317
|
-
|
318
|
-
| Removed | Successor |
|
319
|
-
|:-----------------------------------|:--------------------------------|
|
320
|
-
| ActionController::AbstractRequest | ActionDispatch::Request |
|
321
|
-
| ActionController::Request | ActionDispatch::Request |
|
322
|
-
| ActionController::AbstractResponse | ActionDispatch::Response |
|
323
|
-
| ActionController::Response | ActionDispatch::Response |
|
324
|
-
| ActionController::Routing | ActionDispatch::Routing |
|
325
|
-
| ActionController::Integration | ActionDispatch::Integration |
|
326
|
-
| ActionController::IntegrationTest | ActionDispatch::IntegrationTest |
|
327
|
-
|
328
|
-
### Notable changes
|
329
|
-
|
330
|
-
* `protect_from_forgery` also prevents cross-origin `<script>` tags.
|
331
|
-
Update your tests to use `xhr :get, :foo, format: :js` instead of
|
332
|
-
`get :foo, format: :js`.
|
333
|
-
([Pull Request](https://github.com/rails/rails/pull/13345))
|
334
|
-
|
335
|
-
* `#url_for` takes a hash with options inside an
|
336
|
-
array. ([Pull Request](https://github.com/rails/rails/pull/9599))
|
337
|
-
|
338
|
-
* Added `session#fetch` method fetch behaves similarly to
|
339
|
-
[Hash#fetch](http://www.ruby-doc.org/core-1.9.3/Hash.html#method-i-fetch),
|
340
|
-
with the exception that the returned value is always saved into the
|
341
|
-
session. ([Pull Request](https://github.com/rails/rails/pull/12692))
|
342
|
-
|
343
|
-
* Separated Action View completely from Action
|
344
|
-
Pack. ([Pull Request](https://github.com/rails/rails/pull/11032))
|
345
|
-
|
346
|
-
* Log which keys were affected by deep
|
347
|
-
munge. ([Pull Request](https://github.com/rails/rails/pull/13813))
|
348
|
-
|
349
|
-
* New config option `config.action_dispatch.perform_deep_munge` to opt out of
|
350
|
-
params "deep munging" that was used to address security vulnerability
|
351
|
-
CVE-2013-0155. ([Pull Request](https://github.com/rails/rails/pull/13188))
|
352
|
-
|
353
|
-
* New config option `config.action_dispatch.cookies_serializer` for specifying a
|
354
|
-
serializer for the signed and encrypted cookie jars. (Pull Requests
|
355
|
-
[1](https://github.com/rails/rails/pull/13692),
|
356
|
-
[2](https://github.com/rails/rails/pull/13945) /
|
357
|
-
[More Details](upgrading_ruby_on_rails.html#cookies-serializer))
|
358
|
-
|
359
|
-
* Added `render :plain`, `render :html` and `render
|
360
|
-
:body`. ([Pull Request](https://github.com/rails/rails/pull/14062) /
|
361
|
-
[More Details](upgrading_ruby_on_rails.html#rendering-content-from-string))
|
362
|
-
|
363
|
-
|
364
|
-
Action Mailer
|
365
|
-
-------------
|
366
|
-
|
367
|
-
Please refer to the
|
368
|
-
[Changelog](https://github.com/rails/rails/blob/4-1-stable/actionmailer/CHANGELOG.md)
|
369
|
-
for detailed changes.
|
370
|
-
|
371
|
-
### Notable changes
|
372
|
-
|
373
|
-
* Added mailer previews feature based on 37 Signals mail_view
|
374
|
-
gem. ([Commit](https://github.com/rails/rails/commit/d6dec7fcb6b8fddf8c170182d4fe64ecfc7b2261))
|
375
|
-
|
376
|
-
* Instrument the generation of Action Mailer messages. The time it takes to
|
377
|
-
generate a message is written to the log. ([Pull Request](https://github.com/rails/rails/pull/12556))
|
378
|
-
|
379
|
-
|
380
|
-
Active Record
|
381
|
-
-------------
|
382
|
-
|
383
|
-
Please refer to the
|
384
|
-
[Changelog](https://github.com/rails/rails/blob/4-1-stable/activerecord/CHANGELOG.md)
|
385
|
-
for detailed changes.
|
386
|
-
|
387
|
-
### Removals
|
388
|
-
|
389
|
-
* Removed deprecated nil-passing to the following `SchemaCache` methods:
|
390
|
-
`primary_keys`, `tables`, `columns` and `columns_hash`.
|
391
|
-
|
392
|
-
* Removed deprecated block filter from `ActiveRecord::Migrator#migrate`.
|
393
|
-
|
394
|
-
* Removed deprecated String constructor from `ActiveRecord::Migrator`.
|
395
|
-
|
396
|
-
* Removed deprecated `scope` use without passing a callable object.
|
397
|
-
|
398
|
-
* Removed deprecated `transaction_joinable=` in favor of `begin_transaction`
|
399
|
-
with `d:joinable` option.
|
400
|
-
|
401
|
-
* Removed deprecated `decrement_open_transactions`.
|
402
|
-
|
403
|
-
* Removed deprecated `increment_open_transactions`.
|
404
|
-
|
405
|
-
* Removed deprecated `PostgreSQLAdapter#outside_transaction?`
|
406
|
-
method. You can use `#transaction_open?` instead.
|
407
|
-
|
408
|
-
* Removed deprecated `ActiveRecord::Fixtures.find_table_name` in favor of
|
409
|
-
`ActiveRecord::Fixtures.default_fixture_model_name`.
|
410
|
-
|
411
|
-
* Removed deprecated `columns_for_remove` from `SchemaStatements`.
|
412
|
-
|
413
|
-
* Removed deprecated `SchemaStatements#distinct`.
|
414
|
-
|
415
|
-
* Moved deprecated `ActiveRecord::TestCase` into the Rails test
|
416
|
-
suite. The class is no longer public and is only used for internal
|
417
|
-
Rails tests.
|
418
|
-
|
419
|
-
* Removed support for deprecated option `:restrict` for `:dependent`
|
420
|
-
in associations.
|
421
|
-
|
422
|
-
* Removed support for deprecated `:delete_sql`, `:insert_sql`, `:finder_sql`
|
423
|
-
and `:counter_sql` options in associations.
|
424
|
-
|
425
|
-
* Removed deprecated method `type_cast_code` from Column.
|
426
|
-
|
427
|
-
* Removed deprecated `ActiveRecord::Base#connection` method.
|
428
|
-
Make sure to access it via the class.
|
429
|
-
|
430
|
-
* Removed deprecation warning for `auto_explain_threshold_in_seconds`.
|
431
|
-
|
432
|
-
* Removed deprecated `:distinct` option from `Relation#count`.
|
433
|
-
|
434
|
-
* Removed deprecated methods `partial_updates`, `partial_updates?` and
|
435
|
-
`partial_updates=`.
|
436
|
-
|
437
|
-
* Removed deprecated method `scoped`.
|
438
|
-
|
439
|
-
* Removed deprecated method `default_scopes?`.
|
440
|
-
|
441
|
-
* Remove implicit join references that were deprecated in 4.0.
|
442
|
-
|
443
|
-
* Removed `activerecord-deprecated_finders` as a dependency.
|
444
|
-
Please see [the gem README](https://github.com/rails/activerecord-deprecated_finders#active-record-deprecated-finders)
|
445
|
-
for more info.
|
446
|
-
|
447
|
-
* Removed usage of `implicit_readonly`. Please use `readonly` method
|
448
|
-
explicitly to mark records as
|
449
|
-
`readonly`. ([Pull Request](https://github.com/rails/rails/pull/10769))
|
450
|
-
|
451
|
-
### Deprecations
|
452
|
-
|
453
|
-
* Deprecated `quoted_locking_column` method, which isn't used anywhere.
|
454
|
-
|
455
|
-
* Deprecated `ConnectionAdapters::SchemaStatements#distinct`,
|
456
|
-
as it is no longer used by internals. ([Pull Request](https://github.com/rails/rails/pull/10556))
|
457
|
-
|
458
|
-
* Deprecated `rake db:test:*` tasks as the test database is now
|
459
|
-
automatically maintained. See railties release notes. ([Pull
|
460
|
-
Request](https://github.com/rails/rails/pull/13528))
|
461
|
-
|
462
|
-
* Deprecate unused `ActiveRecord::Base.symbolized_base_class`
|
463
|
-
and `ActiveRecord::Base.symbolized_sti_name` without
|
464
|
-
replacement. [Commit](https://github.com/rails/rails/commit/97e7ca48c139ea5cce2fa9b4be631946252a1ebd)
|
465
|
-
|
466
|
-
### Notable changes
|
467
|
-
|
468
|
-
* Default scopes are no longer overriden by chained conditions.
|
469
|
-
|
470
|
-
Before this change when you defined a `default_scope` in a model
|
471
|
-
it was overriden by chained conditions in the same field. Now it
|
472
|
-
is merged like any other scope. [More Details](upgrading_ruby_on_rails.html#changes-on-default-scopes).
|
473
|
-
|
474
|
-
* Added `ActiveRecord::Base.to_param` for convenient "pretty" URLs derived from
|
475
|
-
a model's attribute or
|
476
|
-
method. ([Pull Request](https://github.com/rails/rails/pull/12891))
|
477
|
-
|
478
|
-
* Added `ActiveRecord::Base.no_touching`, which allows ignoring touch on
|
479
|
-
models. ([Pull Request](https://github.com/rails/rails/pull/12772))
|
480
|
-
|
481
|
-
* Unify boolean type casting for `MysqlAdapter` and `Mysql2Adapter`.
|
482
|
-
`type_cast` will return `1` for `true` and `0` for `false`. ([Pull Request](https://github.com/rails/rails/pull/12425))
|
483
|
-
|
484
|
-
* `.unscope` now removes conditions specified in
|
485
|
-
`default_scope`. ([Commit](https://github.com/rails/rails/commit/94924dc32baf78f13e289172534c2e71c9c8cade))
|
486
|
-
|
487
|
-
* Added `ActiveRecord::QueryMethods#rewhere` which will overwrite an existing,
|
488
|
-
named where condition. ([Commit](https://github.com/rails/rails/commit/f950b2699f97749ef706c6939a84dfc85f0b05f2))
|
489
|
-
|
490
|
-
* Extended `ActiveRecord::Base#cache_key` to take an optional list of timestamp
|
491
|
-
attributes of which the highest will be used. ([Commit](https://github.com/rails/rails/commit/e94e97ca796c0759d8fcb8f946a3bbc60252d329))
|
492
|
-
|
493
|
-
* Added `ActiveRecord::Base#enum` for declaring enum attributes where the values
|
494
|
-
map to integers in the database, but can be queried by
|
495
|
-
name. ([Commit](https://github.com/rails/rails/commit/db41eb8a6ea88b854bf5cd11070ea4245e1639c5))
|
496
|
-
|
497
|
-
* Type cast json values on write, so that the value is consistent with reading
|
498
|
-
from the database. ([Pull Request](https://github.com/rails/rails/pull/12643))
|
499
|
-
|
500
|
-
* Type cast hstore values on write, so that the value is consistent
|
501
|
-
with reading from the database. ([Commit](https://github.com/rails/rails/commit/5ac2341fab689344991b2a4817bd2bc8b3edac9d))
|
502
|
-
|
503
|
-
* Make `next_migration_number` accessible for third party
|
504
|
-
generators. ([Pull Request](https://github.com/rails/rails/pull/12407))
|
505
|
-
|
506
|
-
* Calling `update_attributes` will now throw an `ArgumentError` whenever it
|
507
|
-
gets a `nil` argument. More specifically, it will throw an error if the
|
508
|
-
argument that it gets passed does not respond to to
|
509
|
-
`stringify_keys`. ([Pull Request](https://github.com/rails/rails/pull/9860))
|
510
|
-
|
511
|
-
* `CollectionAssociation#first`/`#last` (e.g. `has_many`) use a `LIMIT`ed
|
512
|
-
query to fetch results rather than loading the entire
|
513
|
-
collection. ([Pull Request](https://github.com/rails/rails/pull/12137))
|
514
|
-
|
515
|
-
* `inspect` on Active Record model classes does not initiate a new
|
516
|
-
connection. This means that calling `inspect`, when the database is missing,
|
517
|
-
will no longer raise an exception. ([Pull Request](https://github.com/rails/rails/pull/11014))
|
518
|
-
|
519
|
-
* Removed column restrictions for `count`, let the database raise if the SQL is
|
520
|
-
invalid. ([Pull Request](https://github.com/rails/rails/pull/10710))
|
521
|
-
|
522
|
-
* Rails now automatically detects inverse associations. If you do not set the
|
523
|
-
`:inverse_of` option on the association, then Active Record will guess the
|
524
|
-
inverse association based on heuristics. ([Pull Request](https://github.com/rails/rails/pull/10886))
|
525
|
-
|
526
|
-
* Handle aliased attributes in ActiveRecord::Relation. When using symbol keys,
|
527
|
-
ActiveRecord will now translate aliased attribute names to the actual column
|
528
|
-
name used in the database. ([Pull Request](https://github.com/rails/rails/pull/7839))
|
529
|
-
|
530
|
-
* The ERB in fixture files is no longer evaluated in the context of the main
|
531
|
-
object. Helper methods used by multiple fixtures should be defined on modules
|
532
|
-
included in `ActiveRecord::FixtureSet.context_class`. ([Pull Request](https://github.com/rails/rails/pull/13022))
|
533
|
-
|
534
|
-
* Don't create or drop the test database if RAILS_ENV is specified
|
535
|
-
explicitly. ([Pull Request](https://github.com/rails/rails/pull/13629))
|
536
|
-
|
537
|
-
* `Relation` no longer has mutator methods like `#map!` and `#delete_if`. Convert
|
538
|
-
to an `Array` by calling `#to_a` before using these methods. ([Pull Request](https://github.com/rails/rails/pull/13314))
|
539
|
-
|
540
|
-
* `find_in_batches`, `find_each`, `Result#each` and `Enumerable#index_by` now
|
541
|
-
return an `Enumerator` that can calculate its
|
542
|
-
size. ([Pull Request](https://github.com/rails/rails/pull/13938))
|
543
|
-
|
544
|
-
* `scope`, `enum` and Associations now raise on "dangerous" name
|
545
|
-
conflicts. ([Pull Request](https://github.com/rails/rails/pull/13450),
|
546
|
-
[Pull Request](https://github.com/rails/rails/pull/13896))
|
547
|
-
|
548
|
-
* `second` through `fifth` methods act like the `first`
|
549
|
-
finder. ([Pull Request](https://github.com/rails/rails/pull/13757))
|
550
|
-
|
551
|
-
* Make `touch` fire the `after_commit` and `after_rollback`
|
552
|
-
callbacks. ([Pull Request](https://github.com/rails/rails/pull/12031))
|
553
|
-
|
554
|
-
* Enable partial indexes for `sqlite >= 3.8.0`.
|
555
|
-
([Pull Request](https://github.com/rails/rails/pull/13350))
|
556
|
-
|
557
|
-
* Make `change_column_null`
|
558
|
-
revertable. ([Commit](https://github.com/rails/rails/commit/724509a9d5322ff502aefa90dd282ba33a281a96))
|
559
|
-
|
560
|
-
* Added a flag to disable schema dump after migration. This is set to `false`
|
561
|
-
by default in the production environment for new applications.
|
562
|
-
([Pull Request](https://github.com/rails/rails/pull/13948))
|
563
|
-
|
564
|
-
|
565
|
-
Active Model
|
566
|
-
------------
|
567
|
-
|
568
|
-
Please refer to the
|
569
|
-
[Changelog](https://github.com/rails/rails/blob/4-1-stable/activemodel/CHANGELOG.md)
|
570
|
-
for detailed changes.
|
571
|
-
|
572
|
-
### Deprecations
|
573
|
-
|
574
|
-
* Deprecate `Validator#setup`. This should be done manually now in the
|
575
|
-
validator's constructor. ([Commit](https://github.com/rails/rails/commit/7d84c3a2f7ede0e8d04540e9c0640de7378e9b3a))
|
576
|
-
|
577
|
-
### Notable changes
|
578
|
-
|
579
|
-
* Added new API methods `reset_changes` and `changes_applied` to
|
580
|
-
`ActiveModel::Dirty` that control changes state.
|
581
|
-
|
582
|
-
* Ability to specify multiple contexts when defining a
|
583
|
-
validation. ([Pull Request](https://github.com/rails/rails/pull/13754))
|
584
|
-
|
585
|
-
* `attribute_changed?` now accepts a hash to check if the attribute was changed
|
586
|
-
`:from` and/or `:to` a given
|
587
|
-
value. ([Pull Request](https://github.com/rails/rails/pull/13131))
|
588
|
-
|
589
|
-
|
590
|
-
Active Support
|
591
|
-
--------------
|
592
|
-
|
593
|
-
Please refer to the
|
594
|
-
[Changelog](https://github.com/rails/rails/blob/4-1-stable/activesupport/CHANGELOG.md)
|
595
|
-
for detailed changes.
|
596
|
-
|
597
|
-
|
598
|
-
### Removals
|
599
|
-
|
600
|
-
* Removed `MultiJSON` dependency. As a result, `ActiveSupport::JSON.decode`
|
601
|
-
no longer accepts an options hash for `MultiJSON`. ([Pull Request](https://github.com/rails/rails/pull/10576) / [More Details](upgrading_ruby_on_rails.html#changes-in-json-handling))
|
602
|
-
|
603
|
-
* Removed support for the `encode_json` hook used for encoding custom objects into
|
604
|
-
JSON. This feature has been extracted into the [activesupport-json_encoder](https://github.com/rails/activesupport-json_encoder)
|
605
|
-
gem.
|
606
|
-
([Related Pull Request](https://github.com/rails/rails/pull/12183) /
|
607
|
-
[More Details](upgrading_ruby_on_rails.html#changes-in-json-handling))
|
608
|
-
|
609
|
-
* Removed deprecated `ActiveSupport::JSON::Variable` with no replacement.
|
610
|
-
|
611
|
-
* Removed deprecated `String#encoding_aware?` core extensions (`core_ext/string/encoding`).
|
612
|
-
|
613
|
-
* Removed deprecated `Module#local_constant_names` in favor of `Module#local_constants`.
|
614
|
-
|
615
|
-
* Removed deprecated `DateTime.local_offset` in favor of `DateTime.civil_from_format`.
|
616
|
-
|
617
|
-
* Removed deprecated `Logger` core extensions (`core_ext/logger.rb`).
|
618
|
-
|
619
|
-
* Removed deprecated `Time#time_with_datetime_fallback`, `Time#utc_time` and
|
620
|
-
`Time#local_time` in favor of `Time#utc` and `Time#local`.
|
621
|
-
|
622
|
-
* Removed deprecated `Hash#diff` with no replacement.
|
623
|
-
|
624
|
-
* Removed deprecated `Date#to_time_in_current_zone` in favor of `Date#in_time_zone`.
|
625
|
-
|
626
|
-
* Removed deprecated `Proc#bind` with no replacement.
|
627
|
-
|
628
|
-
* Removed deprecated `Array#uniq_by` and `Array#uniq_by!`, use native
|
629
|
-
`Array#uniq` and `Array#uniq!` instead.
|
630
|
-
|
631
|
-
* Removed deprecated `ActiveSupport::BasicObject`, use
|
632
|
-
`ActiveSupport::ProxyObject` instead.
|
633
|
-
|
634
|
-
* Removed deprecated `BufferedLogger`, use `ActiveSupport::Logger` instead.
|
635
|
-
|
636
|
-
* Removed deprecated `assert_present` and `assert_blank` methods, use `assert
|
637
|
-
object.blank?` and `assert object.present?` instead.
|
638
|
-
|
639
|
-
* Remove deprecated `#filter` method for filter objects, use the corresponding
|
640
|
-
method instead (e.g. `#before` for a before filter).
|
641
|
-
|
642
|
-
* Removed 'cow' => 'kine' irregular inflection from default
|
643
|
-
inflections. ([Commit](https://github.com/rails/rails/commit/c300dca9963bda78b8f358dbcb59cabcdc5e1dc9))
|
644
|
-
|
645
|
-
### Deprecations
|
646
|
-
|
647
|
-
* Deprecated `Numeric#{ago,until,since,from_now}`, the user is expected to
|
648
|
-
explicitly convert the value into an AS::Duration, i.e. `5.ago` => `5.seconds.ago`
|
649
|
-
([Pull Request](https://github.com/rails/rails/pull/12389))
|
650
|
-
|
651
|
-
* Deprecated the require path `active_support/core_ext/object/to_json`. Require
|
652
|
-
`active_support/core_ext/object/json` instead. ([Pull Request](https://github.com/rails/rails/pull/12203))
|
653
|
-
|
654
|
-
* Deprecated `ActiveSupport::JSON::Encoding::CircularReferenceError`. This feature
|
655
|
-
has been extracted into the [activesupport-json_encoder](https://github.com/rails/activesupport-json_encoder)
|
656
|
-
gem.
|
657
|
-
([Pull Request](https://github.com/rails/rails/pull/12785) /
|
658
|
-
[More Details](upgrading_ruby_on_rails.html#changes-in-json-handling))
|
659
|
-
|
660
|
-
* Deprecated `ActiveSupport.encode_big_decimal_as_string` option. This feature has
|
661
|
-
been extracted into the [activesupport-json_encoder](https://github.com/rails/activesupport-json_encoder)
|
662
|
-
gem.
|
663
|
-
([Pull Request](https://github.com/rails/rails/pull/13060) /
|
664
|
-
[More Details](upgrading_ruby_on_rails.html#changes-in-json-handling))
|
665
|
-
|
666
|
-
* Deprecate custom `BigDecimal`
|
667
|
-
serialization. ([Pull Request](https://github.com/rails/rails/pull/13911))
|
668
|
-
|
669
|
-
### Notable changes
|
670
|
-
|
671
|
-
* `ActiveSupport`'s JSON encoder has been rewritten to take advantage of the
|
672
|
-
JSON gem rather than doing custom encoding in pure-Ruby.
|
673
|
-
([Pull Request](https://github.com/rails/rails/pull/12183) /
|
674
|
-
[More Details](upgrading_ruby_on_rails.html#changes-in-json-handling))
|
675
|
-
|
676
|
-
* Improved compatibility with the JSON gem.
|
677
|
-
([Pull Request](https://github.com/rails/rails/pull/12862) /
|
678
|
-
[More Details](upgrading_ruby_on_rails.html#changes-in-json-handling))
|
679
|
-
|
680
|
-
* Added `ActiveSupport::Testing::TimeHelpers#travel` and `#travel_to`. These
|
681
|
-
methods change current time to the given time or duration by stubbing
|
682
|
-
`Time.now` and `Date.today`.
|
683
|
-
|
684
|
-
* Added `ActiveSupport::Testing::TimeHelpers#travel_back`. This method returns
|
685
|
-
the current time to the original state, by removing the stubs added by `travel`
|
686
|
-
and `travel_to`. ([Pull Request](https://github.com/rails/rails/pull/13884))
|
687
|
-
|
688
|
-
* Added `Numeric#in_milliseconds`, like `1.hour.in_milliseconds`, so we can feed
|
689
|
-
them to JavaScript functions like
|
690
|
-
`getTime()`. ([Commit](https://github.com/rails/rails/commit/423249504a2b468d7a273cbe6accf4f21cb0e643))
|
691
|
-
|
692
|
-
* Added `Date#middle_of_day`, `DateTime#middle_of_day` and `Time#middle_of_day`
|
693
|
-
methods. Also added `midday`, `noon`, `at_midday`, `at_noon` and
|
694
|
-
`at_middle_of_day` as
|
695
|
-
aliases. ([Pull Request](https://github.com/rails/rails/pull/10879))
|
696
|
-
|
697
|
-
* Added `Date#all_week/month/quarter/year` for generating date
|
698
|
-
ranges. ([Pull Request](https://github.com/rails/rails/pull/9685))
|
699
|
-
|
700
|
-
* Added `Time.zone.yesterday` and
|
701
|
-
`Time.zone.tomorrow`. ([Pull Request](https://github.com/rails/rails/pull/12822))
|
702
|
-
|
703
|
-
* Added `String#remove(pattern)` as a short-hand for the common pattern of
|
704
|
-
`String#gsub(pattern,'')`. ([Commit](https://github.com/rails/rails/commit/5da23a3f921f0a4a3139495d2779ab0d3bd4cb5f))
|
705
|
-
|
706
|
-
* Added `Hash#compact` and `Hash#compact!` for removing items with nil value
|
707
|
-
from hash. ([Pull Request](https://github.com/rails/rails/pull/13632))
|
708
|
-
|
709
|
-
* `blank?` and `present?` commit to return
|
710
|
-
singletons. ([Commit](https://github.com/rails/rails/commit/126dc47665c65cd129967cbd8a5926dddd0aa514))
|
711
|
-
|
712
|
-
* Default the new `I18n.enforce_available_locales` config to `true`, meaning
|
713
|
-
`I18n` will make sure that all locales passed to it must be declared in the
|
714
|
-
`available_locales`
|
715
|
-
list. ([Pull Request](https://github.com/rails/rails/pull/13341))
|
716
|
-
|
717
|
-
* Introduce `Module#concerning`: a natural, low-ceremony way to separate
|
718
|
-
responsibilities within a
|
719
|
-
class. ([Commit](https://github.com/rails/rails/commit/1eee0ca6de975b42524105a59e0521d18b38ab81))
|
720
|
-
|
721
|
-
* Added `Object#presence_in` to simplify value whitelisting.
|
722
|
-
([Commit](https://github.com/rails/rails/commit/4edca106daacc5a159289eae255207d160f22396))
|
723
|
-
|
724
|
-
|
725
|
-
Credits
|
726
|
-
-------
|
727
|
-
|
728
|
-
See the
|
729
|
-
[full list of contributors to Rails](http://contributors.rubyonrails.org/) for
|
730
|
-
the many people who spent many hours making Rails, the stable and robust
|
731
|
-
framework it is. Kudos to all of them.
|