rails 4.0.0 → 4.2.11.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +30 -23
- data/guides/CHANGELOG.md +108 -6
- data/guides/Rakefile +21 -6
- data/guides/assets/images/akshaysurve.jpg +0 -0
- data/guides/assets/images/edge_badge.png +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/header_tile.gif +0 -0
- data/guides/assets/images/icons/README +1 -1
- 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/15.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/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/vijaydev.jpg +0 -0
- data/guides/assets/javascripts/guides.js +36 -34
- data/guides/assets/stylesheets/main.css +6 -2
- data/guides/assets/stylesheets/print.css +1 -1
- data/guides/bug_report_templates/action_controller_gem.rb +47 -0
- data/guides/bug_report_templates/action_controller_master.rb +54 -0
- data/guides/bug_report_templates/active_record_gem.rb +5 -2
- data/guides/bug_report_templates/active_record_master.rb +3 -2
- data/guides/bug_report_templates/generic_gem.rb +15 -0
- data/guides/bug_report_templates/generic_master.rb +26 -0
- data/guides/rails_guides.rb +23 -4
- data/guides/rails_guides/generator.rb +1 -1
- data/guides/rails_guides/helpers.rb +4 -2
- data/guides/rails_guides/levenshtein.rb +27 -21
- data/guides/rails_guides/markdown.rb +11 -7
- data/guides/rails_guides/markdown/renderer.rb +1 -1
- data/guides/source/2_2_release_notes.md +3 -3
- data/guides/source/2_3_release_notes.md +12 -12
- data/guides/source/3_0_release_notes.md +10 -13
- data/guides/source/3_1_release_notes.md +7 -4
- data/guides/source/3_2_release_notes.md +17 -14
- data/guides/source/4_0_release_notes.md +110 -54
- data/guides/source/4_1_release_notes.md +730 -0
- data/guides/source/4_2_release_notes.md +877 -0
- data/guides/source/_license.html.erb +1 -1
- data/guides/source/_welcome.html.erb +6 -2
- data/guides/source/action_controller_overview.md +223 -57
- data/guides/source/action_mailer_basics.md +129 -76
- data/guides/source/action_view_overview.md +247 -246
- data/guides/source/active_job_basics.md +339 -0
- data/guides/source/active_model_basics.md +374 -20
- data/guides/source/active_record_basics.md +46 -45
- data/guides/source/active_record_callbacks.md +83 -28
- data/guides/source/{migrations.md → active_record_migrations.md} +191 -275
- data/guides/source/active_record_postgresql.md +433 -0
- data/guides/source/active_record_querying.md +382 -300
- data/guides/source/active_record_validations.md +64 -55
- data/guides/source/active_support_core_extensions.md +229 -187
- data/guides/source/active_support_instrumentation.md +23 -22
- data/guides/source/api_documentation_guidelines.md +167 -15
- data/guides/source/asset_pipeline.md +768 -294
- data/guides/source/association_basics.md +188 -96
- data/guides/source/autoloading_and_reloading_constants.md +1311 -0
- data/guides/source/caching_with_rails.md +45 -11
- data/guides/source/command_line.md +96 -65
- data/guides/source/configuring.md +404 -70
- data/guides/source/contributing_to_ruby_on_rails.md +270 -130
- data/guides/source/credits.html.erb +7 -3
- data/guides/source/debugging_rails_applications.md +471 -284
- data/guides/source/development_dependencies_install.md +115 -21
- data/guides/source/documents.yaml +31 -9
- data/guides/source/engines.md +737 -291
- data/guides/source/form_helpers.md +137 -89
- data/guides/source/generators.md +60 -28
- data/guides/source/getting_started.md +1007 -596
- data/guides/source/i18n.md +178 -96
- data/guides/source/index.html.erb +2 -1
- data/guides/source/initialization.md +248 -104
- data/guides/source/kindle/toc.html.erb +1 -1
- data/guides/source/layout.html.erb +14 -22
- data/guides/source/layouts_and_rendering.md +78 -46
- data/guides/source/maintenance_policy.md +78 -0
- data/guides/source/nested_model_forms.md +10 -7
- data/guides/source/plugins.md +66 -57
- data/guides/source/rails_application_templates.md +49 -12
- data/guides/source/rails_on_rack.md +50 -60
- data/guides/source/routing.md +190 -139
- data/guides/source/ruby_on_rails_guides_guidelines.md +12 -13
- data/guides/source/security.md +134 -83
- data/guides/source/testing.md +322 -200
- data/guides/source/upgrading_ruby_on_rails.md +834 -37
- data/guides/source/working_with_javascript_in_rails.md +36 -26
- data/guides/w3c_validator.rb +2 -0
- metadata +93 -116
- data/guides/assets/images/getting_started/forbidden_attributes_for_new_post.png +0 -0
- data/guides/assets/images/getting_started/new_post.png +0 -0
- data/guides/assets/images/getting_started/post_with_comments.png +0 -0
- data/guides/assets/images/getting_started/show_action_for_posts.png +0 -0
- data/guides/assets/images/getting_started/template_is_missing_posts_new.png +0 -0
- data/guides/assets/images/getting_started/undefined_method_post_path.png +0 -0
- data/guides/assets/images/getting_started/unknown_action_create_for_posts.png +0 -0
- data/guides/assets/images/getting_started/unknown_action_new_for_posts.png +0 -0
- data/guides/assets/images/jaimeiniesta.jpg +0 -0
- data/guides/code/getting_started/Gemfile +0 -43
- data/guides/code/getting_started/Gemfile.lock +0 -150
- 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 -16
- 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 -17
- data/guides/code/getting_started/app/controllers/posts_controller.rb +0 -47
- 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 -3
- 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 -58
- data/guides/code/getting_started/public/422.html +0 -58
- data/guides/code/getting_started/public/500.html +0 -57
- 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 -15
- data/guides/source/kindle/KINDLE.md +0 -26
@@ -1,14 +1,14 @@
|
|
1
1
|
Ruby on Rails 2.3 Release Notes
|
2
2
|
===============================
|
3
3
|
|
4
|
-
Rails 2.3 delivers a variety of new and improved features, including pervasive Rack integration, refreshed support for Rails Engines, nested transactions for Active Record, dynamic and default scopes, unified rendering, more efficient routing, application templates, and quiet backtraces. This list covers the major upgrades, but doesn't include every little bug fix and change. If you want to see everything, check out the [list of commits](http://github.com/rails/rails/commits/
|
4
|
+
Rails 2.3 delivers a variety of new and improved features, including pervasive Rack integration, refreshed support for Rails Engines, nested transactions for Active Record, dynamic and default scopes, unified rendering, more efficient routing, application templates, and quiet backtraces. This list covers the major upgrades, but doesn't include every little bug fix and change. If you want to see everything, check out the [list of commits](http://github.com/rails/rails/commits/2-3-stable) in the main Rails repository on GitHub or review the `CHANGELOG` files for the individual Rails components.
|
5
5
|
|
6
6
|
--------------------------------------------------------------------------------
|
7
7
|
|
8
8
|
Application Architecture
|
9
9
|
------------------------
|
10
10
|
|
11
|
-
There are two major changes in the architecture of Rails applications: complete integration of the [Rack](http://rack.
|
11
|
+
There are two major changes in the architecture of Rails applications: complete integration of the [Rack](http://rack.github.io/) modular web server interface, and renewed support for Rails Engines.
|
12
12
|
|
13
13
|
### Rack Integration
|
14
14
|
|
@@ -40,7 +40,7 @@ Here's a summary of the rack-related changes:
|
|
40
40
|
* `ActiveRecord::QueryCache` middleware is automatically inserted onto the middleware stack if `ActiveRecord` has been loaded. This middleware sets up and flushes the per-request Active Record query cache.
|
41
41
|
* The Rails router and controller classes follow the Rack spec. You can call a controller directly with `SomeController.call(env)`. The router stores the routing parameters in `rack.routing_args`.
|
42
42
|
* `ActionController::Request` inherits from `Rack::Request`.
|
43
|
-
* Instead of `config.action_controller.session = { :session_key => 'foo', ...` use
|
43
|
+
* Instead of `config.action_controller.session = { :session_key => 'foo', ...` use `config.action_controller.session = { :key => 'foo', ...`.
|
44
44
|
* Using the `ParamsParser` middleware preprocesses any XML, JSON, or YAML requests so they can be read normally with any `Rack::Request` object after it.
|
45
45
|
|
46
46
|
### Renewed Support for Rails Engines
|
@@ -173,8 +173,8 @@ before_save :update_credit_rating, :if => :active,
|
|
173
173
|
Rails now has a `:having` option on find (as well as on `has_many` and `has_and_belongs_to_many` associations) for filtering records in grouped finds. As those with heavy SQL backgrounds know, this allows filtering based on grouped results:
|
174
174
|
|
175
175
|
```ruby
|
176
|
-
developers =
|
177
|
-
:having => "sum(salary) >
|
176
|
+
developers = Developer.find(:all, :group => "salary",
|
177
|
+
:having => "sum(salary) > 10000", :select => "salary")
|
178
178
|
```
|
179
179
|
|
180
180
|
* Lead Contributor: [Emilio Tagua](http://github.com/miloops)
|
@@ -237,7 +237,7 @@ If you're one of the people who has always been bothered by the special-case nam
|
|
237
237
|
|
238
238
|
### HTTP Digest Authentication Support
|
239
239
|
|
240
|
-
Rails now has built-in support for HTTP digest authentication. To use it, you call `authenticate_or_request_with_http_digest` with a block that returns the user
|
240
|
+
Rails now has built-in support for HTTP digest authentication. To use it, you call `authenticate_or_request_with_http_digest` with a block that returns the user's password (which is then hashed and compared against the transmitted credentials):
|
241
241
|
|
242
242
|
```ruby
|
243
243
|
class PostsController < ApplicationController
|
@@ -451,11 +451,11 @@ select(:post, :category, Post::CATEGORIES, :disabled => 'private')
|
|
451
451
|
returns
|
452
452
|
|
453
453
|
```html
|
454
|
-
<select name
|
454
|
+
<select name="post[category]">
|
455
455
|
<option>story</option>
|
456
456
|
<option>joke</option>
|
457
457
|
<option>poem</option>
|
458
|
-
<option disabled
|
458
|
+
<option disabled="disabled">private</option>
|
459
459
|
</select>
|
460
460
|
```
|
461
461
|
|
@@ -594,7 +594,7 @@ The internals of the various <code>rake gem</code> tasks have been substantially
|
|
594
594
|
* Various files in /public that deal with CGI and FCGI dispatching are no longer generated in every Rails application by default (you can still get them if you need them by adding `--with-dispatchers` when you run the `rails` command, or add them later with `rake rails:update:generate_dispatchers`).
|
595
595
|
* Rails Guides have been converted from AsciiDoc to Textile markup.
|
596
596
|
* Scaffolded views and controllers have been cleaned up a bit.
|
597
|
-
* `script/server` now accepts a
|
597
|
+
* `script/server` now accepts a `--path` argument to mount a Rails application from a specific path.
|
598
598
|
* If any configured gems are missing, the gem rake tasks will skip loading much of the environment. This should solve many of the "chicken-and-egg" problems where rake gems:install couldn't run because gems were missing.
|
599
599
|
* Gems are now unpacked exactly once. This fixes issues with gems (hoe, for instance) which are packed with read-only permissions on the files.
|
600
600
|
|
@@ -604,9 +604,9 @@ Deprecated
|
|
604
604
|
A few pieces of older code are deprecated in this release:
|
605
605
|
|
606
606
|
* If you're one of the (fairly rare) Rails developers who deploys in a fashion that depends on the inspector, reaper, and spawner scripts, you'll need to know that those scripts are no longer included in core Rails. If you need them, you'll be able to pick up copies via the [irs_process_scripts](http://github.com/rails/irs_process_scripts/tree) plugin.
|
607
|
-
* `render_component` goes from "deprecated" to "nonexistent" in Rails 2.3. If you still need it, you can install the [render_component plugin](http://github.com/rails/render_component/tree/master.
|
607
|
+
* `render_component` goes from "deprecated" to "nonexistent" in Rails 2.3. If you still need it, you can install the [render_component plugin](http://github.com/rails/render_component/tree/master).
|
608
608
|
* Support for Rails components has been removed.
|
609
|
-
* If you were one of the people who got used to running `script/performance/request` to look at performance based on integration tests, you need to learn a new trick: that script has been removed from core Rails now. There
|
609
|
+
* If you were one of the people who got used to running `script/performance/request` to look at performance based on integration tests, you need to learn a new trick: that script has been removed from core Rails now. There's a new request_profiler plugin that you can install to get the exact same functionality back.
|
610
610
|
* `ActionController::Base#session_enabled?` is deprecated because sessions are lazy-loaded now.
|
611
611
|
* The `:digest` and `:secret` options to `protect_from_forgery` are deprecated and have no effect.
|
612
612
|
* Some integration test helpers have been removed. `response.headers["Status"]` and `headers["Status"]` will no longer return anything. Rack does not allow "Status" in its return headers. However you can still use the `status` and `status_message` helpers. `response.headers["cookie"]` and `headers["cookie"]` will no longer return any CGI cookies. You can inspect `headers["Set-Cookie"]` to see the raw cookie header or use the `cookies` helper to get a hash of the cookies sent to the client.
|
@@ -618,4 +618,4 @@ A few pieces of older code are deprecated in this release:
|
|
618
618
|
Credits
|
619
619
|
-------
|
620
620
|
|
621
|
-
Release notes compiled by [Mike Gunderloy](http://afreshcup.com.
|
621
|
+
Release notes compiled by [Mike Gunderloy](http://afreshcup.com). This version of the Rails 2.3 release notes was compiled based on RC2 of Rails 2.3.
|
@@ -15,7 +15,7 @@ Even if you don't give a hoot about any of our internal cleanups, Rails 3.0 is g
|
|
15
15
|
|
16
16
|
On top of all that, we've tried our best to deprecate the old APIs with nice warnings. That means that you can move your existing application to Rails 3 without immediately rewriting all your old code to the latest best practices.
|
17
17
|
|
18
|
-
These release notes cover the major upgrades, but don't include every little bug fix and change. Rails 3.0 consists of almost 4,000 commits by more than 250 authors! If you want to see everything, check out the [list of commits](http://github.com/rails/rails/commits/
|
18
|
+
These release notes cover the major upgrades, but don't include every little bug fix and change. Rails 3.0 consists of almost 4,000 commits by more than 250 authors! If you want to see everything, check out the [list of commits](http://github.com/rails/rails/commits/3-0-stable) in the main Rails repository on GitHub.
|
19
19
|
|
20
20
|
--------------------------------------------------------------------------------
|
21
21
|
|
@@ -73,8 +73,6 @@ You can see an example of how that works at [Rails Upgrade is now an Official Pl
|
|
73
73
|
|
74
74
|
Aside from Rails Upgrade tool, if you need more help, there are people on IRC and [rubyonrails-talk](http://groups.google.com/group/rubyonrails-talk) that are probably doing the same thing, possibly hitting the same issues. Be sure to blog your own experiences when upgrading so others can benefit from your knowledge!
|
75
75
|
|
76
|
-
More information - [The Path to Rails 3: Approaching the upgrade](http://omgbloglol.com/post/353978923/the-path-to-rails-3-approaching-the-upgrade)
|
77
|
-
|
78
76
|
Creating a Rails 3.0 application
|
79
77
|
--------------------------------
|
80
78
|
|
@@ -140,7 +138,7 @@ More Information: - [Rails Edge Architecture](http://yehudakatz.com/2009/06/11/r
|
|
140
138
|
|
141
139
|
[Arel](http://github.com/brynary/arel) (or Active Relation) has been taken on as the underpinnings of Active Record and is now required for Rails. Arel provides an SQL abstraction that simplifies out Active Record and provides the underpinnings for the relation functionality in Active Record.
|
142
140
|
|
143
|
-
More information: - [Why I wrote Arel](http://magicscalingsprinkles.wordpress.com/2010/01/28/why-i-wrote-arel
|
141
|
+
More information: - [Why I wrote Arel](https://web.archive.org/web/20120718093140/http://magicscalingsprinkles.wordpress.com/2010/01/28/why-i-wrote-arel/)
|
144
142
|
|
145
143
|
|
146
144
|
### Mail Extraction
|
@@ -296,11 +294,11 @@ NOTE. The old style `map` commands still work as before with a backwards compati
|
|
296
294
|
Deprecations
|
297
295
|
|
298
296
|
* The catch all route for non-REST applications (`/:controller/:action/:id`) is now commented out.
|
299
|
-
* Routes
|
297
|
+
* Routes `:path_prefix` no longer exists and `:name_prefix` now automatically adds "_" at the end of the given value.
|
300
298
|
|
301
299
|
More Information:
|
302
300
|
* [The Rails 3 Router: Rack it Up](http://yehudakatz.com/2009/12/26/the-rails-3-router-rack-it-up/)
|
303
|
-
* [Revamped Routes in Rails 3](
|
301
|
+
* [Revamped Routes in Rails 3](https://medium.com/fusion-of-thoughts/revamped-routes-in-rails-3-b6d00654e5b0)
|
304
302
|
* [Generic Actions in Rails 3](http://yehudakatz.com/2009/12/20/generic-actions-in-rails-3/)
|
305
303
|
|
306
304
|
|
@@ -310,7 +308,7 @@ More Information:
|
|
310
308
|
|
311
309
|
Major re-write was done in the Action View helpers, implementing Unobtrusive JavaScript (UJS) hooks and removing the old inline AJAX commands. This enables Rails to use any compliant UJS driver to implement the UJS hooks in the helpers.
|
312
310
|
|
313
|
-
What this means is that all previous `remote_<method>` helpers have been removed from Rails core and put into the [Prototype Legacy Helper](http://github.com/rails/prototype_legacy_helper.
|
311
|
+
What this means is that all previous `remote_<method>` helpers have been removed from Rails core and put into the [Prototype Legacy Helper](http://github.com/rails/prototype_legacy_helper). To get UJS hooks into your HTML, you now pass `:remote => true` instead. For example:
|
314
312
|
|
315
313
|
```ruby
|
316
314
|
form_for @post, :remote => true
|
@@ -342,7 +340,7 @@ Helpers that do something else, like `cache` or `content_for`, are not affected
|
|
342
340
|
* Helpers now output HTML 5 by default.
|
343
341
|
* Form label helper now pulls values from I18n with a single value, so `f.label :name` will pull the `:name` translation.
|
344
342
|
* I18n select label on should now be :en.helpers.select instead of :en.support.select.
|
345
|
-
* You no longer need to place a minus sign at the end of a
|
343
|
+
* You no longer need to place a minus sign at the end of a Ruby interpolation inside an ERB template to remove the trailing carriage return in the HTML output.
|
346
344
|
* Added `grouped_collection_select` helper to Action View.
|
347
345
|
* `content_for?` has been added allowing you to check for the existence of content in a view before rendering.
|
348
346
|
* passing `:value => nil` to form helpers will set the field's `value` attribute to nil as opposed to using the default value
|
@@ -523,7 +521,7 @@ A large effort was made in Active Support to make it cherry pickable, that is, y
|
|
523
521
|
These are the main changes in Active Support:
|
524
522
|
|
525
523
|
* Large clean up of the library removing unused methods throughout.
|
526
|
-
* Active Support no longer provides vendored versions of
|
524
|
+
* Active Support no longer provides vendored versions of TZInfo, Memcache Client and Builder. These are all included as dependencies and installed via the `bundle install` command.
|
527
525
|
* Safe buffers are implemented in `ActiveSupport::SafeBuffer`.
|
528
526
|
* Added `Array.uniq_by` and `Array.uniq_by!`.
|
529
527
|
* Removed `Array#rand` and backported `Array#sample` from Ruby 1.9.
|
@@ -547,7 +545,7 @@ These are the main changes in Active Support:
|
|
547
545
|
* `String#to_time` and `String#to_datetime` handle fractional seconds.
|
548
546
|
* Added support to new callbacks for around filter object that respond to `:before` and `:after` used in before and after callbacks.
|
549
547
|
* The `ActiveSupport::OrderedHash#to_a` method returns an ordered set of arrays. Matches Ruby 1.9's `Hash#to_a`.
|
550
|
-
* `MissingSourceFile` exists as a constant but it is now just
|
548
|
+
* `MissingSourceFile` exists as a constant but it is now just equal to `LoadError`.
|
551
549
|
* Added `Class#class_attribute`, to be able to declare a class-level attribute whose value is inheritable and overwritable by subclasses.
|
552
550
|
* Finally removed `DeprecatedCallbacks` in `ActiveRecord::Associations`.
|
553
551
|
* `Object#metaclass` is now `Kernel#singleton_class` to match Ruby.
|
@@ -576,7 +574,7 @@ The following methods have been removed because they are no longer used in the f
|
|
576
574
|
Action Mailer
|
577
575
|
-------------
|
578
576
|
|
579
|
-
Action Mailer has been given a new API with TMail being replaced out with the new [Mail](http://github.com/mikel/mail) as the
|
577
|
+
Action Mailer has been given a new API with TMail being replaced out with the new [Mail](http://github.com/mikel/mail) as the email library. Action Mailer itself has been given an almost complete re-write with pretty much every line of code touched. The result is that Action Mailer now simply inherits from Abstract Controller and wraps the Mail gem in a Rails DSL. This reduces the amount of code and duplication of other libraries in Action Mailer considerably.
|
580
578
|
|
581
579
|
* All mailers are now in `app/mailers` by default.
|
582
580
|
* Can now send email using new API with three methods: `attachments`, `headers` and `mail`.
|
@@ -610,5 +608,4 @@ Credits
|
|
610
608
|
|
611
609
|
See the [full list of contributors to Rails](http://contributors.rubyonrails.org/) for the many people who spent many hours making Rails 3. Kudos to all of them.
|
612
610
|
|
613
|
-
Rails 3.0 Release Notes were compiled by [Mikel Lindsaar](http://lindsaar.net.
|
614
|
-
|
611
|
+
Rails 3.0 Release Notes were compiled by [Mikel Lindsaar](http://lindsaar.net).
|
@@ -8,7 +8,10 @@ Highlights in Rails 3.1:
|
|
8
8
|
* Assets Pipeline
|
9
9
|
* jQuery as the default JavaScript library
|
10
10
|
|
11
|
-
|
11
|
+
These release notes cover only the major changes. To learn about various bug
|
12
|
+
fixes and changes, please refer to the change logs or check out the [list of
|
13
|
+
commits](https://github.com/rails/rails/commits/3-1-stable) in the main Rails
|
14
|
+
repository on GitHub.
|
12
15
|
|
13
16
|
--------------------------------------------------------------------------------
|
14
17
|
|
@@ -169,11 +172,11 @@ Rails Architectural Changes
|
|
169
172
|
|
170
173
|
The major change in Rails 3.1 is the Assets Pipeline. It makes CSS and JavaScript first-class code citizens and enables proper organization, including use in plugins and engines.
|
171
174
|
|
172
|
-
The assets pipeline is powered by [Sprockets](https://github.com/
|
175
|
+
The assets pipeline is powered by [Sprockets](https://github.com/rails/sprockets) and is covered in the [Asset Pipeline](asset_pipeline.html) guide.
|
173
176
|
|
174
177
|
### HTTP Streaming
|
175
178
|
|
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
|
179
|
+
HTTP Streaming is another change that is new in Rails 3.1. This lets the browser download your stylesheets and JavaScript files while the server is still generating the response. This requires Ruby 1.9.2, is opt-in and requires support from the web server as well, but the popular combo of NGINX and Unicorn is ready to take advantage of it.
|
177
180
|
|
178
181
|
### Default JS library is now jQuery
|
179
182
|
|
@@ -286,7 +289,7 @@ Action Pack
|
|
286
289
|
end
|
287
290
|
```
|
288
291
|
|
289
|
-
You can restrict it to some actions by using `:only` or `:except`. Please read the docs at [`ActionController::Streaming`](http://api.rubyonrails.org/classes/ActionController/Streaming.html) for more information.
|
292
|
+
You can restrict it to some actions by using `:only` or `:except`. Please read the docs at [`ActionController::Streaming`](http://api.rubyonrails.org/v3.1.0/classes/ActionController/Streaming.html) for more information.
|
290
293
|
|
291
294
|
* The redirect route method now also accepts a hash of options which will only change the parts of the url in question, or an object which responds to call, allowing for redirects to be reused.
|
292
295
|
|
@@ -8,7 +8,10 @@ Highlights in Rails 3.2:
|
|
8
8
|
* Automatic Query Explains
|
9
9
|
* Tagged Logging
|
10
10
|
|
11
|
-
These release notes cover the major changes
|
11
|
+
These release notes cover only the major changes. To learn about various bug
|
12
|
+
fixes and changes, please refer to the change logs or check out the [list of
|
13
|
+
commits](https://github.com/rails/rails/commits/3-2-stable) in the main Rails
|
14
|
+
repository on GitHub.
|
12
15
|
|
13
16
|
--------------------------------------------------------------------------------
|
14
17
|
|
@@ -21,7 +24,7 @@ If you're upgrading an existing application, it's a great idea to have good test
|
|
21
24
|
|
22
25
|
Rails 3.2 requires Ruby 1.8.7 or higher. Support for all of the previous Ruby versions has been dropped officially and you should upgrade as early as possible. Rails 3.2 is also compatible with Ruby 1.9.2.
|
23
26
|
|
24
|
-
TIP: Note that Ruby 1.8.7 p248 and p249 have
|
27
|
+
TIP: Note that Ruby 1.8.7 p248 and p249 have marshalling bugs that crash Rails. Ruby Enterprise Edition has these fixed since the release of 1.8.7-2010.02. On the 1.9 front, Ruby 1.9.1 is not usable because it outright segfaults, so if you want to use 1.9.x, jump on to 1.9.2 or 1.9.3 for smooth sailing.
|
25
28
|
|
26
29
|
### What to update in your apps
|
27
30
|
|
@@ -137,7 +140,7 @@ Railties
|
|
137
140
|
|
138
141
|
* Update `Rails::Rack::Logger` middleware to apply any tags set in `config.log_tags` to `ActiveSupport::TaggedLogging`. This makes it easy to tag log lines with debug information like subdomain and request id -- both very helpful in debugging multi-user production applications.
|
139
142
|
|
140
|
-
* Default options to `rails new` can be set in `~/.railsrc`. You can specify extra command-line arguments to be used every time
|
143
|
+
* Default options to `rails new` can be set in `~/.railsrc`. You can specify extra command-line arguments to be used every time `rails new` runs in the `.railsrc` configuration file in your home directory.
|
141
144
|
|
142
145
|
* Add an alias `d` for `destroy`. This works for engines too.
|
143
146
|
|
@@ -185,9 +188,9 @@ Action Pack
|
|
185
188
|
end
|
186
189
|
```
|
187
190
|
|
188
|
-
Rails will use
|
191
|
+
Rails will use `layouts/single_car` when a request comes in `:show` action, and use `layouts/application` (or `layouts/cars`, if exists) when a request comes in for any other actions.
|
189
192
|
|
190
|
-
*
|
193
|
+
* `form_for` is changed to use `#{action}_#{as}` as the css class and id if `:as` option is provided. Earlier versions used `#{as}_#{action}`.
|
191
194
|
|
192
195
|
* `ActionController::ParamsWrapper` on Active Record models now only wrap `attr_accessible` attributes if they were set. If not, only the attributes returned by the class method `attribute_names` will be wrapped. This fixes the wrapping of nested attributes by adding them to `attr_accessible`.
|
193
196
|
|
@@ -219,7 +222,7 @@ Action Pack
|
|
219
222
|
|
220
223
|
* MIME type entries for PDF, ZIP and other formats were added.
|
221
224
|
|
222
|
-
* Allow fresh_when/stale
|
225
|
+
* Allow `fresh_when/stale?` to take a record instead of an options hash.
|
223
226
|
|
224
227
|
* Changed log level of warning for missing CSRF token from `:debug` to `:warn`.
|
225
228
|
|
@@ -227,7 +230,7 @@ Action Pack
|
|
227
230
|
|
228
231
|
#### Deprecations
|
229
232
|
|
230
|
-
* Deprecated implied layout lookup in controllers whose parent had
|
233
|
+
* Deprecated implied layout lookup in controllers whose parent had an explicit layout set:
|
231
234
|
|
232
235
|
```ruby
|
233
236
|
class ApplicationController
|
@@ -238,13 +241,13 @@ Action Pack
|
|
238
241
|
end
|
239
242
|
```
|
240
243
|
|
241
|
-
In the example above,
|
244
|
+
In the example above, `PostsController` will no longer automatically look up for a posts layout. If you need this functionality you could either remove `layout "application"` from `ApplicationController` or explicitly set it to `nil` in `PostsController`.
|
242
245
|
|
243
|
-
* Deprecated `ActionController::UnknownAction` in
|
246
|
+
* Deprecated `ActionController::UnknownAction` in favor of `AbstractController::ActionNotFound`.
|
244
247
|
|
245
|
-
* Deprecated `ActionController::DoubleRenderError` in
|
248
|
+
* Deprecated `ActionController::DoubleRenderError` in favor of `AbstractController::DoubleRenderError`.
|
246
249
|
|
247
|
-
* Deprecated `method_missing` in
|
250
|
+
* Deprecated `method_missing` in favor of `action_missing` for missing actions.
|
248
251
|
|
249
252
|
* Deprecated `ActionController#rescue_action`, `ActionController#initialize_template_class` and `ActionController#assign_shortcuts`.
|
250
253
|
|
@@ -254,7 +257,7 @@ Action Pack
|
|
254
257
|
|
255
258
|
* Added `ActionDispatch::RequestId` middleware that'll make a unique X-Request-Id header available to the response and enables the `ActionDispatch::Request#uuid` method. This makes it easy to trace requests from end-to-end in the stack and to identify individual requests in mixed logs like Syslog.
|
256
259
|
|
257
|
-
* The `ShowExceptions` middleware now accepts
|
260
|
+
* The `ShowExceptions` middleware now accepts an exceptions application that is responsible to render an exception when the application fails. The application is invoked with a copy of the exception in `env["action_dispatch.exception"]` and with the `PATH_INFO` rewritten to the status code.
|
258
261
|
|
259
262
|
* Allow rescue responses to be configured through a railtie as in `config.action_dispatch.rescue_responses`.
|
260
263
|
|
@@ -375,7 +378,7 @@ Active Record
|
|
375
378
|
|
376
379
|
* Support index sort order in SQLite, MySQL and PostgreSQL adapters.
|
377
380
|
|
378
|
-
* Allow the `:class_name` option for associations to take a symbol in addition to a string. This is to avoid confusing newbies, and to be consistent with the fact that other options like
|
381
|
+
* Allow the `:class_name` option for associations to take a symbol in addition to a string. This is to avoid confusing newbies, and to be consistent with the fact that other options like `:foreign_key` already allow a symbol or a string.
|
379
382
|
|
380
383
|
```ruby
|
381
384
|
has_many :clients, :class_name => :Client # Note that the symbol need to be capitalized
|
@@ -562,4 +565,4 @@ Credits
|
|
562
565
|
|
563
566
|
See the [full list of contributors to Rails](http://contributors.rubyonrails.org/) for the many people who spent many hours making Rails, the stable and robust framework it is. Kudos to all of them.
|
564
567
|
|
565
|
-
Rails 3.2 Release Notes were compiled by [Vijay Dev](https://github.com/vijaydev.
|
568
|
+
Rails 3.2 Release Notes were compiled by [Vijay Dev](https://github.com/vijaydev).
|
@@ -8,14 +8,17 @@ Highlights in Rails 4.0:
|
|
8
8
|
* Turbolinks
|
9
9
|
* Russian Doll Caching
|
10
10
|
|
11
|
-
These release notes cover only the major changes. To
|
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-0-stable) in the main Rails
|
14
|
+
repository on GitHub.
|
12
15
|
|
13
16
|
--------------------------------------------------------------------------------
|
14
17
|
|
15
18
|
Upgrading to Rails 4.0
|
16
19
|
----------------------
|
17
20
|
|
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
|
21
|
+
If you're upgrading an existing application, it's a great idea to have good test coverage before going in. You should also first upgrade to Rails 3.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
22
|
|
20
23
|
|
21
24
|
Creating a Rails 4.0 application
|
@@ -50,24 +53,61 @@ $ ruby /path/to/rails/railties/bin/rails new myapp --dev
|
|
50
53
|
Major Features
|
51
54
|
--------------
|
52
55
|
|
53
|
-
|
56
|
+
[![Rails 4.0](images/rails4_features.png)](http://guides.rubyonrails.org/images/rails4_features.png)
|
54
57
|
|
55
|
-
|
58
|
+
### Upgrade
|
59
|
+
|
60
|
+
* **Ruby 1.9.3** ([commit](https://github.com/rails/rails/commit/a0380e808d3dbd2462df17f5d3b7fcd8bd812496)) - Ruby 2.0 preferred; 1.9.3+ required
|
61
|
+
* **[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.
|
62
|
+
* **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.
|
63
|
+
* **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.
|
64
|
+
* **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.
|
65
|
+
* **ActiveModel mass assignment protection** ([commit](https://github.com/rails/rails/commit/f8c9a4d3e88181cee644f91e1342bfe896ca64c6)) - Rails 3 mass assignment protection is deprecated. Instead, use strong parameters.
|
66
|
+
* **ActiveResource** ([commit](https://github.com/rails/rails/commit/f1637bf2bb00490203503fbd943b73406e043d1d)) - ActiveResource is extracted to a separate gem. ActiveResource was not widely used.
|
67
|
+
* **vendor/plugins removed** ([commit](https://github.com/rails/rails/commit/853de2bd9ac572735fa6cf59fcf827e485a231c3)) - Use a Gemfile to manage installed gems.
|
68
|
+
|
69
|
+
### ActionPack
|
70
|
+
|
71
|
+
* **Strong parameters** ([commit](https://github.com/rails/rails/commit/a8f6d5c6450a7fe058348a7f10a908352bb6c7fc)) - Only allow whitelisted parameters to update model objects (`params.permit(:title, :text)`).
|
72
|
+
* **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`).
|
73
|
+
* **ActionController::Live** ([commit](https://github.com/rails/rails/commit/af0a9f9eefaee3a8120cfd8d05cbc431af376da3)) - Stream JSON with `response.stream`.
|
74
|
+
* **Declarative ETags** ([commit](https://github.com/rails/rails/commit/ed5c938fa36995f06d4917d9543ba78ed506bb8d)) - Add controller-level etag additions that will be part of the action etag computation
|
75
|
+
* **[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.
|
76
|
+
* **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.
|
77
|
+
* **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.
|
78
|
+
* **Do not depend on ActiveModel** ([commit](https://github.com/rails/rails/commit/166dbaa7526a96fdf046f093f25b0a134b277a68)) - ActionPack no longer depends on ActiveModel.
|
79
|
+
|
80
|
+
### General
|
81
|
+
|
82
|
+
* **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`)
|
83
|
+
* **New scope API** ([commit](https://github.com/rails/rails/commit/50cbc03d18c5984347965a94027879623fc44cce)) - Scopes must always use callables.
|
84
|
+
* **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.
|
85
|
+
* **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.
|
86
|
+
* **Dalli** ([commit](https://github.com/rails/rails/commit/82663306f428a5bbc90c511458432afb26d2f238)) - Use Dalli memcache client for the memcache store.
|
87
|
+
* **Notifications start & finish** ([commit](https://github.com/rails/rails/commit/f08f8750a512f741acb004d0cebe210c5f949f28)) - Active Support instrumentation reports start and finish notifications to subscribers.
|
88
|
+
* **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.
|
89
|
+
* **PATCH verb** ([commit](https://github.com/rails/rails/commit/eed9f2539e3ab5a68e798802f464b8e4e95e619e)) - In Rails, PATCH replaces PUT. PATCH is used for partial updates of resources.
|
90
|
+
|
91
|
+
### Security
|
92
|
+
|
93
|
+
* **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.
|
94
|
+
* **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.
|
95
|
+
* **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).
|
56
96
|
|
57
97
|
Extraction of features to gems
|
58
98
|
---------------------------
|
59
99
|
|
60
100
|
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.
|
61
101
|
|
62
|
-
* Hash-based & Dynamic finder methods ([
|
63
|
-
* Mass assignment protection in Active Record models ([
|
64
|
-
* ActiveRecord::SessionStore ([
|
65
|
-
* Active Record Observers ([
|
66
|
-
* Active Resource ([
|
67
|
-
* Action Caching ([
|
68
|
-
* Page Caching ([
|
69
|
-
* Sprockets ([
|
70
|
-
* Performance tests ([
|
102
|
+
* Hash-based & Dynamic finder methods ([GitHub](https://github.com/rails/activerecord-deprecated_finders))
|
103
|
+
* Mass assignment protection in Active Record models ([GitHub](https://github.com/rails/protected_attributes), [Pull Request](https://github.com/rails/rails/pull/7251))
|
104
|
+
* ActiveRecord::SessionStore ([GitHub](https://github.com/rails/activerecord-session_store), [Pull Request](https://github.com/rails/rails/pull/7436))
|
105
|
+
* Active Record Observers ([GitHub](https://github.com/rails/rails-observers), [Commit](https://github.com/rails/rails/commit/39e85b3b90c58449164673909a6f1893cba290b2))
|
106
|
+
* 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))
|
107
|
+
* Action Caching ([GitHub](https://github.com/rails/actionpack-action_caching), [Pull Request](https://github.com/rails/rails/pull/7833))
|
108
|
+
* Page Caching ([GitHub](https://github.com/rails/actionpack-page_caching), [Pull Request](https://github.com/rails/rails/pull/7833))
|
109
|
+
* Sprockets ([GitHub](https://github.com/rails/sprockets-rails))
|
110
|
+
* Performance tests ([GitHub](https://github.com/rails/rails-perftest), [Pull Request](https://github.com/rails/rails/pull/8876))
|
71
111
|
|
72
112
|
Documentation
|
73
113
|
-------------
|
@@ -79,16 +119,20 @@ Documentation
|
|
79
119
|
Railties
|
80
120
|
--------
|
81
121
|
|
82
|
-
Please refer to the [Changelog](https://github.com/rails/rails/blob/
|
122
|
+
Please refer to the [Changelog](https://github.com/rails/rails/blob/4-0-stable/railties/CHANGELOG.md) for detailed changes.
|
83
123
|
|
84
124
|
### Notable changes
|
85
125
|
|
86
|
-
*
|
126
|
+
* 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))
|
87
127
|
|
88
|
-
* Your app's executables now live in the `bin/`
|
128
|
+
* Your app's executables now live in the `bin/` directory. Run `rake rails:update:bin` to get `bin/bundle`, `bin/rails`, and `bin/rake`.
|
89
129
|
|
90
130
|
* Threadsafe on by default
|
91
131
|
|
132
|
+
* Ability to use a custom builder by passing `--builder` (or `-b`) to
|
133
|
+
`rails new` has been removed. Consider using application templates
|
134
|
+
instead. ([Pull Request](https://github.com/rails/rails/pull/9401))
|
135
|
+
|
92
136
|
### Deprecations
|
93
137
|
|
94
138
|
* `config.threadsafe!` is deprecated in favor of `config.eager_load` which provides a more fine grained control on what is eager loaded.
|
@@ -98,7 +142,7 @@ Please refer to the [Changelog](https://github.com/rails/rails/blob/master/railt
|
|
98
142
|
Action Mailer
|
99
143
|
-------------
|
100
144
|
|
101
|
-
Please refer to the [Changelog](https://github.com/rails/rails/blob/
|
145
|
+
Please refer to the [Changelog](https://github.com/rails/rails/blob/4-0-stable/actionmailer/CHANGELOG.md) for detailed changes.
|
102
146
|
|
103
147
|
### Notable changes
|
104
148
|
|
@@ -107,50 +151,62 @@ Please refer to the [Changelog](https://github.com/rails/rails/blob/master/actio
|
|
107
151
|
Active Model
|
108
152
|
------------
|
109
153
|
|
110
|
-
Please refer to the [Changelog](https://github.com/rails/rails/blob/
|
154
|
+
Please refer to the [Changelog](https://github.com/rails/rails/blob/4-0-stable/activemodel/CHANGELOG.md) for detailed changes.
|
111
155
|
|
112
156
|
### Notable changes
|
113
157
|
|
114
|
-
*
|
158
|
+
* Add `ActiveModel::ForbiddenAttributesProtection`, a simple module to protect attributes from mass assignment when non-permitted attributes are passed.
|
115
159
|
|
116
|
-
*
|
117
|
-
Action Pack out of box.
|
160
|
+
* Added `ActiveModel::Model`, a mixin to make Ruby objects work with Action Pack out of box.
|
118
161
|
|
119
162
|
### Deprecations
|
120
163
|
|
121
164
|
Active Support
|
122
165
|
--------------
|
123
166
|
|
124
|
-
Please refer to the [Changelog](https://github.com/rails/rails/blob/
|
167
|
+
Please refer to the [Changelog](https://github.com/rails/rails/blob/4-0-stable/activesupport/CHANGELOG.md) for detailed changes.
|
125
168
|
|
126
169
|
### Notable changes
|
127
170
|
|
128
|
-
*
|
171
|
+
* Replace deprecated `memcache-client` gem with `dalli` in `ActiveSupport::Cache::MemCacheStore`.
|
172
|
+
|
173
|
+
* Optimize `ActiveSupport::Cache::Entry` to reduce memory and processing overhead.
|
174
|
+
|
175
|
+
* Inflections can now be defined per locale. `singularize` and `pluralize` accept locale as an extra argument.
|
176
|
+
|
177
|
+
* `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!`.
|
129
178
|
|
130
|
-
*
|
179
|
+
* `String#to_date` now raises `ArgumentError: invalid date` instead of `NoMethodError: undefined method 'div' for nil:NilClass`
|
180
|
+
when given an invalid date. It is now the same as `Date.parse`, and it accepts more invalid dates than 3.x, such as:
|
131
181
|
|
132
|
-
|
182
|
+
```
|
183
|
+
# ActiveSupport 3.x
|
184
|
+
"asdf".to_date # => NoMethodError: undefined method `div' for nil:NilClass
|
185
|
+
"333".to_date # => NoMethodError: undefined method `div' for nil:NilClass
|
133
186
|
|
134
|
-
|
187
|
+
# ActiveSupport 4
|
188
|
+
"asdf".to_date # => ArgumentError: invalid date
|
189
|
+
"333".to_date # => Fri, 29 Nov 2013
|
190
|
+
```
|
135
191
|
|
136
192
|
### Deprecations
|
137
193
|
|
138
|
-
*
|
194
|
+
* Deprecate `ActiveSupport::TestCase#pending` method, use `skip` from MiniTest instead.
|
139
195
|
|
140
|
-
*
|
196
|
+
* `ActiveSupport::Benchmarkable#silence` has been deprecated due to its lack of thread safety. It will be removed without replacement in Rails 4.1.
|
141
197
|
|
142
|
-
*
|
198
|
+
* `ActiveSupport::JSON::Variable` is deprecated. Define your own `#as_json` and `#encode_json` methods for custom JSON string literals.
|
143
199
|
|
144
|
-
*
|
200
|
+
* Deprecates the compatibility method `Module#local_constant_names`, use `Module#local_constants` instead (which returns symbols).
|
145
201
|
|
146
|
-
*
|
202
|
+
* `BufferedLogger` is deprecated. Use `ActiveSupport::Logger`, or the logger from Ruby standard library.
|
147
203
|
|
148
|
-
*
|
204
|
+
* Deprecate `assert_present` and `assert_blank` in favor of `assert object.blank?` and `assert object.present?`
|
149
205
|
|
150
206
|
Action Pack
|
151
207
|
-----------
|
152
208
|
|
153
|
-
Please refer to the [Changelog](https://github.com/rails/rails/blob/
|
209
|
+
Please refer to the [Changelog](https://github.com/rails/rails/blob/4-0-stable/actionpack/CHANGELOG.md) for detailed changes.
|
154
210
|
|
155
211
|
### Notable changes
|
156
212
|
|
@@ -162,60 +218,60 @@ Please refer to the [Changelog](https://github.com/rails/rails/blob/master/actio
|
|
162
218
|
Active Record
|
163
219
|
-------------
|
164
220
|
|
165
|
-
Please refer to the [Changelog](https://github.com/rails/rails/blob/
|
221
|
+
Please refer to the [Changelog](https://github.com/rails/rails/blob/4-0-stable/activerecord/CHANGELOG.md) for detailed changes.
|
166
222
|
|
167
223
|
### Notable changes
|
168
224
|
|
169
|
-
*
|
225
|
+
* Improve ways to write `change` migrations, making the old `up` & `down` methods no longer necessary.
|
170
226
|
|
171
227
|
* The methods `drop_table` and `remove_column` are now reversible, as long as the necessary information is given.
|
172
228
|
The method `remove_column` used to accept multiple column names; instead use `remove_columns` (which is not revertible).
|
173
229
|
The method `change_table` is also reversible, as long as its block doesn't call `remove`, `change` or `change_default`
|
174
230
|
|
175
231
|
* New method `reversible` makes it possible to specify code to be run when migrating up or down.
|
176
|
-
See the [Guide on Migration](https://github.com/rails/rails/blob/master/guides/source/
|
232
|
+
See the [Guide on Migration](https://github.com/rails/rails/blob/master/guides/source/active_record_migrations.md#using-reversible)
|
177
233
|
|
178
234
|
* New method `revert` will revert a whole migration or the given block.
|
179
235
|
If migrating down, the given migration / block is run normally.
|
180
|
-
See the [Guide on Migration](https://github.com/rails/rails/blob/master/guides/source/
|
236
|
+
See the [Guide on Migration](https://github.com/rails/rails/blob/master/guides/source/active_record_migrations.md#reverting-previous-migrations)
|
181
237
|
|
182
|
-
*
|
238
|
+
* Adds PostgreSQL array type support. Any datatype can be used to create an array column, with full migration and schema dumper support.
|
183
239
|
|
184
|
-
*
|
240
|
+
* Add `Relation#load` to explicitly load the record and return `self`.
|
185
241
|
|
186
|
-
*
|
242
|
+
* `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.
|
187
243
|
|
188
|
-
*
|
244
|
+
* Added `ActiveRecord::Migration.check_pending!` that raises an error if migrations are pending.
|
189
245
|
|
190
|
-
*
|
246
|
+
* Added custom coders support for `ActiveRecord::Store`. Now you can set your custom coder like this:
|
191
247
|
|
192
248
|
store :settings, accessors: [ :color, :homepage ], coder: JSON
|
193
249
|
|
194
|
-
*
|
250
|
+
* `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`.
|
195
251
|
|
196
|
-
*
|
252
|
+
* Remove IdentityMap.
|
197
253
|
|
198
|
-
*
|
254
|
+
* Remove automatic execution of EXPLAIN queries. The option `active_record.auto_explain_threshold_in_seconds` is no longer used and should be removed.
|
199
255
|
|
200
|
-
*
|
256
|
+
* Adds `ActiveRecord::NullRelation` and `ActiveRecord::Relation#none` implementing the null object pattern for the Relation class.
|
201
257
|
|
202
|
-
*
|
258
|
+
* Added `create_join_table` migration helper to create HABTM join tables.
|
203
259
|
|
204
|
-
*
|
260
|
+
* Allows PostgreSQL hstore records to be created.
|
205
261
|
|
206
262
|
### Deprecations
|
207
263
|
|
208
|
-
*
|
264
|
+
* Deprecated the old-style hash based finder API. This means that methods which previously accepted "finder options" no longer do.
|
209
265
|
|
210
|
-
*
|
211
|
-
|
266
|
+
* All dynamic methods except for `find_by_...` and `find_by_...!` are deprecated. Here's
|
267
|
+
how you can rewrite the code:
|
212
268
|
|
213
269
|
* `find_all_by_...` can be rewritten using `where(...)`.
|
214
270
|
* `find_last_by_...` can be rewritten using `where(...).last`.
|
215
271
|
* `scoped_by_...` can be rewritten using `where(...)`.
|
216
|
-
* `find_or_initialize_by_...` can be rewritten using `
|
217
|
-
* `find_or_create_by_...` can be rewritten using `find_or_create_by(...)
|
218
|
-
* `find_or_create_by_...!` can be rewritten using `find_or_create_by!(...)
|
272
|
+
* `find_or_initialize_by_...` can be rewritten using `find_or_initialize_by(...)`.
|
273
|
+
* `find_or_create_by_...` can be rewritten using `find_or_create_by(...)`.
|
274
|
+
* `find_or_create_by_...!` can be rewritten using `find_or_create_by!(...)`.
|
219
275
|
|
220
276
|
Credits
|
221
277
|
-------
|