rails 4.1.16 → 4.2.0.beta1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +3 -3
- data/guides/CHANGELOG.md +13 -102
- data/guides/Rakefile +2 -2
- data/guides/assets/javascripts/guides.js +6 -0
- data/guides/assets/stylesheets/main.css +4 -1
- data/guides/bug_report_templates/action_controller_gem.rb +2 -2
- data/guides/bug_report_templates/action_controller_master.rb +5 -2
- data/guides/bug_report_templates/active_record_master.rb +2 -0
- data/guides/rails_guides.rb +2 -2
- data/guides/rails_guides/helpers.rb +1 -1
- data/guides/rails_guides/levenshtein.rb +29 -21
- data/guides/rails_guides/markdown.rb +6 -7
- data/guides/rails_guides/markdown/renderer.rb +1 -1
- data/guides/source/2_3_release_notes.md +3 -3
- data/guides/source/3_0_release_notes.md +4 -4
- data/guides/source/3_1_release_notes.md +2 -2
- data/guides/source/3_2_release_notes.md +2 -2
- data/guides/source/4_1_release_notes.md +8 -9
- data/guides/source/4_2_release_notes.md +572 -0
- data/guides/source/_license.html.erb +1 -1
- data/guides/source/_welcome.html.erb +2 -8
- data/guides/source/action_controller_overview.md +79 -7
- data/guides/source/action_mailer_basics.md +36 -11
- data/guides/source/action_view_overview.md +138 -119
- data/guides/source/active_job_basics.md +253 -0
- data/guides/source/active_model_basics.md +23 -0
- data/guides/source/active_record_basics.md +16 -15
- data/guides/source/active_record_callbacks.md +12 -9
- data/guides/source/{migrations.md → active_record_migrations.md} +90 -217
- data/guides/source/active_record_postgresql.md +437 -0
- data/guides/source/active_record_querying.md +261 -261
- data/guides/source/active_record_validations.md +7 -7
- data/guides/source/active_support_core_extensions.md +105 -44
- data/guides/source/active_support_instrumentation.md +3 -2
- data/guides/source/api_documentation_guidelines.md +62 -16
- data/guides/source/asset_pipeline.md +58 -46
- data/guides/source/association_basics.md +47 -38
- data/guides/source/caching_with_rails.md +31 -6
- data/guides/source/command_line.md +56 -25
- data/guides/source/configuring.md +98 -19
- data/guides/source/contributing_to_ruby_on_rails.md +174 -111
- data/guides/source/credits.html.erb +1 -1
- data/guides/source/debugging_rails_applications.md +438 -284
- data/guides/source/development_dependencies_install.md +17 -4
- data/guides/source/documents.yaml +11 -7
- data/guides/source/engines.md +192 -203
- data/guides/source/form_helpers.md +54 -45
- data/guides/source/generators.md +20 -11
- data/guides/source/getting_started.md +330 -191
- data/guides/source/i18n.md +92 -62
- data/guides/source/index.html.erb +1 -0
- data/guides/source/initialization.md +108 -59
- data/guides/source/layout.html.erb +1 -4
- data/guides/source/layouts_and_rendering.md +24 -23
- data/guides/source/nested_model_forms.md +3 -3
- data/guides/source/plugins.md +26 -26
- data/guides/source/rails_application_templates.md +21 -3
- data/guides/source/rails_on_rack.md +1 -1
- data/guides/source/routing.md +97 -71
- data/guides/source/ruby_on_rails_guides_guidelines.md +10 -12
- data/guides/source/security.md +39 -33
- data/guides/source/testing.md +111 -108
- data/guides/source/upgrading_ruby_on_rails.md +131 -14
- data/guides/source/working_with_javascript_in_rails.md +18 -16
- data/guides/w3c_validator.rb +2 -0
- metadata +37 -94
- 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
@@ -187,7 +187,7 @@ Action Pack
|
|
187
187
|
|
188
188
|
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
189
|
|
190
|
-
* `
|
190
|
+
* `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
191
|
|
192
192
|
* `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
193
|
|
@@ -562,4 +562,4 @@ Credits
|
|
562
562
|
|
563
563
|
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
564
|
|
565
|
-
Rails 3.2 Release Notes were compiled by [Vijay Dev](https://github.com/vijaydev.
|
565
|
+
Rails 3.2 Release Notes were compiled by [Vijay Dev](https://github.com/vijaydev).
|
@@ -8,10 +8,10 @@ Highlights in Rails 4.1:
|
|
8
8
|
* Action Pack variants
|
9
9
|
* Action Mailer previews
|
10
10
|
|
11
|
-
These release notes cover only the major changes. To
|
12
|
-
fixes and changes, please refer to the change logs or check out the
|
13
|
-
commits](https://github.com/rails/rails/commits/
|
14
|
-
repository on GitHub.
|
11
|
+
These release notes cover only the major changes. To know about various bug
|
12
|
+
fixes and changes, please refer to the change logs or check out the
|
13
|
+
[list of commits](https://github.com/rails/rails/commits/master) in the main
|
14
|
+
Rails repository on GitHub.
|
15
15
|
|
16
16
|
--------------------------------------------------------------------------------
|
17
17
|
|
@@ -396,7 +396,7 @@ for detailed changes.
|
|
396
396
|
* Removed deprecated `scope` use without passing a callable object.
|
397
397
|
|
398
398
|
* Removed deprecated `transaction_joinable=` in favor of `begin_transaction`
|
399
|
-
with
|
399
|
+
with a `:joinable` option.
|
400
400
|
|
401
401
|
* Removed deprecated `decrement_open_transactions`.
|
402
402
|
|
@@ -465,10 +465,10 @@ for detailed changes.
|
|
465
465
|
|
466
466
|
### Notable changes
|
467
467
|
|
468
|
-
* Default scopes are no longer
|
468
|
+
* Default scopes are no longer overridden by chained conditions.
|
469
469
|
|
470
470
|
Before this change when you defined a `default_scope` in a model
|
471
|
-
it was
|
471
|
+
it was overridden by chained conditions in the same field. Now it
|
472
472
|
is merged like any other scope. [More Details](upgrading_ruby_on_rails.html#changes-on-default-scopes).
|
473
473
|
|
474
474
|
* Added `ActiveRecord::Base.to_param` for convenient "pretty" URLs derived from
|
@@ -555,13 +555,12 @@ for detailed changes.
|
|
555
555
|
([Pull Request](https://github.com/rails/rails/pull/13350))
|
556
556
|
|
557
557
|
* Make `change_column_null`
|
558
|
-
|
558
|
+
revertible. ([Commit](https://github.com/rails/rails/commit/724509a9d5322ff502aefa90dd282ba33a281a96))
|
559
559
|
|
560
560
|
* Added a flag to disable schema dump after migration. This is set to `false`
|
561
561
|
by default in the production environment for new applications.
|
562
562
|
([Pull Request](https://github.com/rails/rails/pull/13948))
|
563
563
|
|
564
|
-
|
565
564
|
Active Model
|
566
565
|
------------
|
567
566
|
|
@@ -0,0 +1,572 @@
|
|
1
|
+
Ruby on Rails 4.2 Release Notes
|
2
|
+
===============================
|
3
|
+
|
4
|
+
Highlights in Rails 4.2:
|
5
|
+
|
6
|
+
* Active Job, Action Mailer #deliver_later
|
7
|
+
* Adequate Record
|
8
|
+
* Web Console
|
9
|
+
* Foreign key support
|
10
|
+
|
11
|
+
These release notes cover only the major changes. To know about various bug
|
12
|
+
fixes and changes, please refer to the change logs or check out the
|
13
|
+
[list of commits](https://github.com/rails/rails/commits/master) in the main
|
14
|
+
Rails repository on GitHub.
|
15
|
+
|
16
|
+
--------------------------------------------------------------------------------
|
17
|
+
|
18
|
+
NOTE: This document is a work in progress, please help to improve this by sending
|
19
|
+
a [pull request](https://github.com/rails/rails/edit/master/guides/source/4_2_release_notes.md).
|
20
|
+
|
21
|
+
Upgrading to Rails 4.2
|
22
|
+
----------------------
|
23
|
+
|
24
|
+
If you're upgrading an existing application, it's a great idea to have good test
|
25
|
+
coverage before going in. You should also first upgrade to Rails 4.1 in case you
|
26
|
+
haven't and make sure your application still runs as expected before attempting
|
27
|
+
to upgrade to Rails 4.2. A list of things to watch out for when upgrading is
|
28
|
+
available in the
|
29
|
+
[Upgrading Ruby on Rails](upgrading_ruby_on_rails.html#upgrading-from-rails-4.1-to-rails-4.2)
|
30
|
+
guide.
|
31
|
+
|
32
|
+
|
33
|
+
Major Features
|
34
|
+
--------------
|
35
|
+
|
36
|
+
### Active Job, Action Mailer #deliver_later
|
37
|
+
|
38
|
+
Active Job is a new framework in Rails 4.2. It is an adapter layer on top of
|
39
|
+
queuing systems like Resque, Delayed Job, Sidekiq, and more. You can write your
|
40
|
+
jobs to Active Job, and it'll run on all these queues with no changes. (It comes
|
41
|
+
pre-configured with an inline runner.)
|
42
|
+
|
43
|
+
Building on top of Active Job, Action Mailer now comes with a #deliver_later
|
44
|
+
method, which adds your email to be sent as a job to a queue, so it doesn't
|
45
|
+
bog down the controller or model.
|
46
|
+
|
47
|
+
The new GlobalID library makes it easy to pass Active Record objects to jobs by
|
48
|
+
serializing them in a generic form. This means you no longer have to manually
|
49
|
+
pack and unpack your Active Records by passing ids. Just give the job the
|
50
|
+
straight Active Record object, and it'll serialize it using GlobalID, and
|
51
|
+
deserialize it at run time.
|
52
|
+
|
53
|
+
### Adequate Record
|
54
|
+
|
55
|
+
Rails 4.2 comes with a performance improvement feature called Adequate Record
|
56
|
+
for Active Record. A lot of common queries are now up to twice as fast in Rails
|
57
|
+
4.2!
|
58
|
+
|
59
|
+
TODO: add some technical details
|
60
|
+
|
61
|
+
### Web Console
|
62
|
+
|
63
|
+
New applications generated from Rails 4.2 now comes with the Web Console gem by
|
64
|
+
default.
|
65
|
+
|
66
|
+
Web Console is an IRB console available in the browser. In development mode, you
|
67
|
+
can go to /console and do your work right there. It will also be made available
|
68
|
+
on all exception pages and allows you to jump between the different points in
|
69
|
+
the backtrace.
|
70
|
+
|
71
|
+
### Foreign key support
|
72
|
+
|
73
|
+
The migration DSL now supports adding and removing foreign keys. They are dumped
|
74
|
+
to `schema.rb` as well. At this time, only the `mysql`, `mysql2` and `postgresql`
|
75
|
+
adapters support foreign keys.
|
76
|
+
|
77
|
+
```ruby
|
78
|
+
# add a foreign key to `articles.author_id` referencing `authors.id`
|
79
|
+
add_foreign_key :articles, :authors
|
80
|
+
|
81
|
+
# add a foreign key to `articles.author_id` referencing `users.lng_id`
|
82
|
+
add_foreign_key :articles, :users, column: :author_id, primary_key: "lng_id"
|
83
|
+
|
84
|
+
# remove the foreign key on `accounts.branch_id`
|
85
|
+
remove_foreign_key :accounts, :branches
|
86
|
+
|
87
|
+
# remove the foreign key on `accounts.owner_id`
|
88
|
+
remove_foreign_key :accounts, column: :owner_id
|
89
|
+
```
|
90
|
+
|
91
|
+
See the API documentation on
|
92
|
+
[add_foreign_key](http://api.rubyonrails.org/v4.2.0/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html#method-i-add_foreign_key)
|
93
|
+
and
|
94
|
+
[remove_foreign_key](http://api.rubyonrails.org/v4.2.0/classes/ActiveRecord/ConnectionAdapters/SchemaStatements.html#method-i-remove_foreign_key)
|
95
|
+
for a full description.
|
96
|
+
|
97
|
+
|
98
|
+
Railties
|
99
|
+
--------
|
100
|
+
|
101
|
+
Please refer to the [Changelog][railties] for detailed changes.
|
102
|
+
|
103
|
+
### Removals
|
104
|
+
|
105
|
+
* The `rails application` command has been removed without replacement.
|
106
|
+
([Pull Request](https://github.com/rails/rails/pull/11616))
|
107
|
+
|
108
|
+
### Deprecations
|
109
|
+
|
110
|
+
* Deprecated `Rails::Rack::LogTailer` without replacement.
|
111
|
+
([Commit](https://github.com/rails/rails/commit/84a13e019e93efaa8994b3f8303d635a7702dbce))
|
112
|
+
|
113
|
+
### Notable changes
|
114
|
+
|
115
|
+
* Introduced `web-console` in the default application Gemfile.
|
116
|
+
([Pull Request](https://github.com/rails/rails/pull/16532))
|
117
|
+
|
118
|
+
* Added a `required` option to the model generator for associations.
|
119
|
+
([Pull Request](https://github.com/rails/rails/pull/16062))
|
120
|
+
|
121
|
+
* Introduced an `after_bundle` callback for use in Rails templates.
|
122
|
+
([Pull Request](https://github.com/rails/rails/pull/16359))
|
123
|
+
|
124
|
+
* Introduced the `x` namespace for defining custom configuration options:
|
125
|
+
|
126
|
+
```ruby
|
127
|
+
# config/environments/production.rb
|
128
|
+
config.x.payment_processing.schedule = :daily
|
129
|
+
config.x.payment_processing.retries = 3
|
130
|
+
config.x.super_debugger = true
|
131
|
+
```
|
132
|
+
|
133
|
+
These options are then available through the configuration object:
|
134
|
+
|
135
|
+
```ruby
|
136
|
+
Rails.configuration.x.payment_processing.schedule # => :daily
|
137
|
+
Rails.configuration.x.payment_processing.retries # => 3
|
138
|
+
Rails.configuration.x.super_debugger # => true
|
139
|
+
```
|
140
|
+
|
141
|
+
([Commit](https://github.com/rails/rails/commit/611849772dd66c2e4d005dcfe153f7ce79a8a7db))
|
142
|
+
|
143
|
+
* Introduced `Rails::Application.config_for` to load a configuration for the
|
144
|
+
current environment.
|
145
|
+
|
146
|
+
```ruby
|
147
|
+
# config/exception_notification.yml:
|
148
|
+
production:
|
149
|
+
url: http://127.0.0.1:8080
|
150
|
+
namespace: my_app_production
|
151
|
+
development:
|
152
|
+
url: http://localhost:3001
|
153
|
+
namespace: my_app_development
|
154
|
+
|
155
|
+
# config/production.rb
|
156
|
+
MyApp::Application.configure do
|
157
|
+
config.middleware.use ExceptionNotifier, config_for(:exception_notification)
|
158
|
+
end
|
159
|
+
```
|
160
|
+
|
161
|
+
([Pull Request](https://github.com/rails/rails/pull/16129))
|
162
|
+
|
163
|
+
* Introduced a `--skip-gems` option in the app generator to skip gems such as
|
164
|
+
`turbolinks` and `coffee-rails` that does not have their own specific flags.
|
165
|
+
([Commit](https://github.com/rails/rails/commit/10565895805887d4faf004a6f71219da177f78b7))
|
166
|
+
|
167
|
+
* Introduced a `bin/setup` script to enable automated setup code when
|
168
|
+
bootstrapping an application.
|
169
|
+
([Pull Request](https://github.com/rails/rails/pull/15189))
|
170
|
+
|
171
|
+
* Changed default value for `config.assets.digest` to `true` in development.
|
172
|
+
([Pull Request](https://github.com/rails/rails/pull/15155))
|
173
|
+
|
174
|
+
* Introduced an API to register new extensions for `rake notes`.
|
175
|
+
([Pull Request](https://github.com/rails/rails/pull/14379))
|
176
|
+
|
177
|
+
* Introduced `Rails.gem_version` as a convenience method to return `Gem::Version.new(Rails.version)`.
|
178
|
+
([Pull Request](https://github.com/rails/rails/pull/14101))
|
179
|
+
|
180
|
+
* Introduced an `after_bundle` callback in the Rails templates.
|
181
|
+
([Pull Request](https://github.com/rails/rails/pull/16359))
|
182
|
+
|
183
|
+
|
184
|
+
Action Pack
|
185
|
+
-----------
|
186
|
+
|
187
|
+
Please refer to the [Changelog][action-pack] for detailed changes.
|
188
|
+
|
189
|
+
### Removals
|
190
|
+
|
191
|
+
* `respond_with` and the class-level `respond_to` were removed from Rails and
|
192
|
+
moved to the `responders` gem (version 2.0). Add `gem 'responders', '~> 2.0'`
|
193
|
+
to your `Gemfile` to continue using these features.
|
194
|
+
([Pull Request](https://github.com/rails/rails/pull/16526))
|
195
|
+
|
196
|
+
* Removed deprecated `AbstractController::Helpers::ClassMethods::MissingHelperError`
|
197
|
+
in favor of `AbstractController::Helpers::MissingHelperError`.
|
198
|
+
([Commit](https://github.com/rails/rails/commit/a1ddde15ae0d612ff2973de9cf768ed701b594e8))
|
199
|
+
|
200
|
+
### Deprecations
|
201
|
+
|
202
|
+
* Deprecated `assert_tag`, `assert_no_tag`, `find_tag` and `find_all_tag` in
|
203
|
+
favor of `assert_select`.
|
204
|
+
([Commit](https://github.com/rails/rails-dom-testing/commit/b12850bc5ff23ba4b599bf2770874dd4f11bf750))
|
205
|
+
|
206
|
+
* Deprecated support for setting the `:to` option of a router to a symbol or a
|
207
|
+
string that does not contain a `#` character:
|
208
|
+
|
209
|
+
```ruby
|
210
|
+
get '/posts', to: MyRackApp => (No change necessary)
|
211
|
+
get '/posts', to: 'post#index' => (No change necessary)
|
212
|
+
get '/posts', to: 'posts' => get '/posts', controller: :posts
|
213
|
+
get '/posts', to: :index => get '/posts', action: :index
|
214
|
+
```
|
215
|
+
|
216
|
+
([Commit](https://github.com/rails/rails/commit/cc26b6b7bccf0eea2e2c1a9ebdcc9d30ca7390d9))
|
217
|
+
|
218
|
+
### Notable changes
|
219
|
+
|
220
|
+
* Rails will now automatically include the template's digest in ETags.
|
221
|
+
([Pull Request](https://github.com/rails/rails/pull/16527))
|
222
|
+
|
223
|
+
* `render nothing: true` or rendering a `nil` body no longer add a single
|
224
|
+
space padding to the response body.
|
225
|
+
([Pull Request](https://github.com/rails/rails/pull/14883))
|
226
|
+
|
227
|
+
* Introduced the `always_permitted_parameters` option to configure which
|
228
|
+
parameters are permitted globally. The default value of this configuration
|
229
|
+
is `['controller', 'action']`.
|
230
|
+
([Pull Request](https://github.com/rails/rails/pull/15933))
|
231
|
+
|
232
|
+
* The `*_filter` family methods have been removed from the documentation. Their
|
233
|
+
usage is discouraged in favor of the `*_action` family methods:
|
234
|
+
|
235
|
+
```
|
236
|
+
after_filter => after_action
|
237
|
+
append_after_filter => append_after_action
|
238
|
+
append_around_filter => append_around_action
|
239
|
+
append_before_filter => append_before_action
|
240
|
+
around_filter => around_action
|
241
|
+
before_filter => before_action
|
242
|
+
prepend_after_filter => prepend_after_action
|
243
|
+
prepend_around_filter => prepend_around_action
|
244
|
+
prepend_before_filter => prepend_before_action
|
245
|
+
skip_after_filter => skip_after_action
|
246
|
+
skip_around_filter => skip_around_action
|
247
|
+
skip_before_filter => skip_before_action
|
248
|
+
skip_filter => skip_action_callback
|
249
|
+
```
|
250
|
+
|
251
|
+
If your application is depending on these methods, you should use the
|
252
|
+
replacement `*_action` methods instead. These methods will be deprecated in
|
253
|
+
the future and eventually removed from Rails.
|
254
|
+
|
255
|
+
(Commit [1](https://github.com/rails/rails/commit/6c5f43bab8206747a8591435b2aa0ff7051ad3de),
|
256
|
+
[2](https://github.com/rails/rails/commit/489a8f2a44dc9cea09154ee1ee2557d1f037c7d4))
|
257
|
+
|
258
|
+
* Added HTTP method `MKCALENDAR` from RFC-4791
|
259
|
+
([Pull Request](https://github.com/rails/rails/pull/15121))
|
260
|
+
|
261
|
+
* `*_fragment.action_controller` notifications now include the controller and action name
|
262
|
+
in the payload.
|
263
|
+
([Pull Request](https://github.com/rails/rails/pull/14137))
|
264
|
+
|
265
|
+
* Segments that are passed into URL helpers are now automatically escaped.
|
266
|
+
([Commit](https://github.com/rails/rails/commit/5460591f0226a9d248b7b4f89186bd5553e7768f))
|
267
|
+
|
268
|
+
* Improved the Routing Error page with fuzzy matching for route search.
|
269
|
+
([Pull Request](https://github.com/rails/rails/pull/14619))
|
270
|
+
|
271
|
+
* Added an option to disable logging of CSRF failures.
|
272
|
+
([Pull Request](https://github.com/rails/rails/pull/14280))
|
273
|
+
|
274
|
+
|
275
|
+
Action View
|
276
|
+
-------------
|
277
|
+
|
278
|
+
Please refer to the [Changelog][action-view] for detailed changes.
|
279
|
+
|
280
|
+
### Deprecations
|
281
|
+
|
282
|
+
* Deprecated `AbstractController::Base.parent_prefixes`.
|
283
|
+
Override `AbstractController::Base.local_prefixes` when you want to change
|
284
|
+
where to find views.
|
285
|
+
([Pull Request](https://github.com/rails/rails/pull/15026))
|
286
|
+
|
287
|
+
* Deprecated `ActionView::Digestor#digest(name, format, finder, options = {})`.
|
288
|
+
Arguments should be passed as a hash instead.
|
289
|
+
([Pull Request](https://github.com/rails/rails/pull/14243))
|
290
|
+
|
291
|
+
### Notable changes
|
292
|
+
|
293
|
+
* Introduced a `#{partial_name}_iteration` special local variable for use with
|
294
|
+
partials that are rendered with a collection. It provides access to the
|
295
|
+
current state of the iteration via the `#index`, `#size`, `#first?` and
|
296
|
+
`#last?` methods.
|
297
|
+
([Pull Request](https://github.com/rails/rails/pull/7698))
|
298
|
+
|
299
|
+
* The form helpers no longer generate a `<div>` element with inline CSS around
|
300
|
+
the hidden fields.
|
301
|
+
([Pull Request](https://github.com/rails/rails/pull/14738))
|
302
|
+
|
303
|
+
|
304
|
+
Action Mailer
|
305
|
+
-------------
|
306
|
+
|
307
|
+
Please refer to the [Changelog][action-mailer] for detailed changes.
|
308
|
+
|
309
|
+
### Deprecations
|
310
|
+
|
311
|
+
* Deprecated `*_path` helpers in mailers. Always use `*_url` helpers instead.
|
312
|
+
([Pull Request](https://github.com/rails/rails/pull/15840))
|
313
|
+
|
314
|
+
### Notable changes
|
315
|
+
|
316
|
+
* Introduced `deliver_later` which enqueues a job on the application's queue
|
317
|
+
to deliver the mailer asynchronously.
|
318
|
+
([Pull Request](https://github.com/rails/rails/pull/16485))
|
319
|
+
|
320
|
+
* Added the `show_previews` configuration option for enabling mailer previews
|
321
|
+
outside of the development environment.
|
322
|
+
([Pull Request](https://github.com/rails/rails/pull/15970))
|
323
|
+
|
324
|
+
|
325
|
+
Active Record
|
326
|
+
-------------
|
327
|
+
|
328
|
+
Please refer to the
|
329
|
+
[Changelog](https://github.com/rails/rails/blob/4-2-stable/activerecord/CHANGELOG.md)
|
330
|
+
for detailed changes.
|
331
|
+
|
332
|
+
### Removals
|
333
|
+
|
334
|
+
* Removed `cache_attributes` and friends. All attributes are cached.
|
335
|
+
([Pull Request](https://github.com/rails/rails/pull/15429))
|
336
|
+
|
337
|
+
* Removed deprecated method `ActiveRecord::Base.quoted_locking_column`.
|
338
|
+
([Pull Request](https://github.com/rails/rails/pull/15612))
|
339
|
+
|
340
|
+
* Removed deprecated `ActiveRecord::Migrator.proper_table_name`. Use the
|
341
|
+
`proper_table_name` instance method on `ActiveRecord::Migration` instead.
|
342
|
+
([Pull Request](https://github.com/rails/rails/pull/15512))
|
343
|
+
|
344
|
+
* Removed unused `:timestamp` type. Transparently alias it to `:datetime`
|
345
|
+
in all cases. Fixes inconsistencies when column types are sent outside of
|
346
|
+
`ActiveRecord`, such as for XML Serialization.
|
347
|
+
([Pull Request](https://github.com/rails/rails/pull/15184))
|
348
|
+
|
349
|
+
### Deprecations
|
350
|
+
|
351
|
+
* Deprecated swallowing of errors inside `after_commit` and `after_rollback`.
|
352
|
+
([Pull Request](https://github.com/rails/rails/pull/16537))
|
353
|
+
|
354
|
+
* Deprecated calling `DatabaseTasks.load_schema` without a connection. Use
|
355
|
+
`DatabaseTasks.load_schema_current` instead.
|
356
|
+
([Commit](https://github.com/rails/rails/commit/f15cef67f75e4b52fd45655d7c6ab6b35623c608))
|
357
|
+
|
358
|
+
* Deprecated `Reflection#source_macro` without replacement as it is no longer
|
359
|
+
needed in Active Record.
|
360
|
+
([Pull Request](https://github.com/rails/rails/pull/16373))
|
361
|
+
|
362
|
+
* Deprecated broken support for automatic detection of counter caches on
|
363
|
+
`has_many :through` associations. You should instead manually specify the
|
364
|
+
counter cache on the `has_many` and `belongs_to` associations for the
|
365
|
+
through records.
|
366
|
+
([Pull Request](https://github.com/rails/rails/pull/15754))
|
367
|
+
|
368
|
+
* Deprecated `serialized_attributes` without replacement.
|
369
|
+
([Pull Request](https://github.com/rails/rails/pull/15704))
|
370
|
+
|
371
|
+
* Deprecated returning `nil` from `column_for_attribute` when no column
|
372
|
+
exists. It will return a null object in Rails 5.0
|
373
|
+
([Pull Request](https://github.com/rails/rails/pull/15878))
|
374
|
+
|
375
|
+
* Deprecated using `.joins`, `.preload` and `.eager_load` with associations
|
376
|
+
that depends on the instance state (i.e. those defined with a scope that
|
377
|
+
takes an argument) without replacement.
|
378
|
+
([Commit](https://github.com/rails/rails/commit/ed56e596a0467390011bc9d56d462539776adac1))
|
379
|
+
|
380
|
+
* Deprecated passing Active Record objects to `.find` or `.exists?`. Call
|
381
|
+
`#id` on the objects first.
|
382
|
+
(Commit [1](https://github.com/rails/rails/commit/d92ae6ccca3bcfd73546d612efaea011270bd270),
|
383
|
+
[2](https://github.com/rails/rails/commit/d35f0033c7dec2b8d8b52058fb8db495d49596f7))
|
384
|
+
|
385
|
+
* Deprecated half-baked support for PostgreSQL range values with excluding
|
386
|
+
beginnings. We currently map PostgreSQL ranges to Ruby ranges. This conversion
|
387
|
+
is not fully possible because the Ruby range does not support excluded
|
388
|
+
beginnings.
|
389
|
+
|
390
|
+
The current solution of incrementing the beginning is not correct
|
391
|
+
and is now deprecated. For subtypes where we don't know how to increment
|
392
|
+
(e.g. `#succ` is not defined) it will raise an `ArgumentError` for ranges
|
393
|
+
with excluding beginnings.
|
394
|
+
|
395
|
+
([Commit](https://github.com/rails/rails/commit/91949e48cf41af9f3e4ffba3e5eecf9b0a08bfc3))
|
396
|
+
|
397
|
+
### Notable changes
|
398
|
+
|
399
|
+
* The PostgreSQL adapter now supports the `JSONB` datatype in PostgreSQL 9.4+.
|
400
|
+
([Pull Request](https://github.com/rails/rails/pull/16220))
|
401
|
+
|
402
|
+
* The `#references` method in migrations now supports a `type` option for
|
403
|
+
specifying the type of the foreign key (e.g. `:uuid`).
|
404
|
+
([Pull Request](https://github.com/rails/rails/pull/16231))
|
405
|
+
|
406
|
+
* Added a `:required` option to singular associations, which defines a
|
407
|
+
presence validation on the association.
|
408
|
+
([Pull Request](https://github.com/rails/rails/pull/16056))
|
409
|
+
|
410
|
+
* Introduced `ActiveRecord::Base#validate!` that raises `RecordInvalid` if the
|
411
|
+
record is invalid.
|
412
|
+
([Pull Request](https://github.com/rails/rails/pull/8639))
|
413
|
+
|
414
|
+
* `ActiveRecord::Base#reload` now behaves the same as `m = Model.find(m.id)`,
|
415
|
+
meaning that it no longer retains the extra attributes from custom
|
416
|
+
`select`s.
|
417
|
+
([Pull Request](https://github.com/rails/rails/pull/15866))
|
418
|
+
|
419
|
+
* Introduced the `bin/rake db:purge` task to empty the database for the
|
420
|
+
current environment.
|
421
|
+
([Commit](https://github.com/rails/rails/commit/e2f232aba15937a4b9d14bd91e0392c6d55be58d))
|
422
|
+
|
423
|
+
* `ActiveRecord::Dirty` now detects in-place changes to mutable values.
|
424
|
+
Serialized attributes on ActiveRecord models will no longer save when
|
425
|
+
unchanged. This also works with other types such as string columns and json
|
426
|
+
columns on PostgreSQL.
|
427
|
+
(Pull Requests [1](https://github.com/rails/rails/pull/15674),
|
428
|
+
[2](https://github.com/rails/rails/pull/15786),
|
429
|
+
[3](https://github.com/rails/rails/pull/15788))
|
430
|
+
|
431
|
+
* Added support for `#pretty_print` in `ActiveRecord::Base` objects.
|
432
|
+
([Pull Request](https://github.com/rails/rails/pull/15172))
|
433
|
+
|
434
|
+
* PostgreSQL and SQLite adapters no longer add a default limit of 255
|
435
|
+
characters on string columns.
|
436
|
+
([Pull Request](https://github.com/rails/rails/pull/14579))
|
437
|
+
|
438
|
+
* `sqlite3:///some/path` now resolves to the absolute system path
|
439
|
+
`/some/path`. For relative paths, use `sqlite3:some/path` instead.
|
440
|
+
(Previously, `sqlite3:///some/path` resolved to the relative path
|
441
|
+
`some/path`. This behaviour was deprecated on Rails 4.1.)
|
442
|
+
([Pull Request](https://github.com/rails/rails/pull/14569))
|
443
|
+
|
444
|
+
* Introduced `#validate` as an alias for `#valid?`.
|
445
|
+
([Pull Request](https://github.com/rails/rails/pull/14456))
|
446
|
+
|
447
|
+
* `#touch` now accepts multiple attributes to be touched at once.
|
448
|
+
([Pull Request](https://github.com/rails/rails/pull/14423))
|
449
|
+
|
450
|
+
* Added support for fractional seconds for MySQL 5.6 and above.
|
451
|
+
(Pull Request [1](https://github.com/rails/rails/pull/8240),
|
452
|
+
[2](https://github.com/rails/rails/pull/14359))
|
453
|
+
|
454
|
+
* Added support for the `citext` column type in PostgreSQL adapter.
|
455
|
+
([Pull Request](https://github.com/rails/rails/pull/12523))
|
456
|
+
|
457
|
+
* Added support for user-created range types in PostgreSQL adapter.
|
458
|
+
([Commit](https://github.com/rails/rails/commit/4cb47167e747e8f9dc12b0ddaf82bdb68c03e032))
|
459
|
+
|
460
|
+
|
461
|
+
Active Model
|
462
|
+
------------
|
463
|
+
|
464
|
+
Please refer to the [Changelog][active-model] for detailed changes.
|
465
|
+
|
466
|
+
### Removals
|
467
|
+
|
468
|
+
* Removed deprecated `Validator#setup` without replacement.
|
469
|
+
([Pull Request](https://github.com/rails/rails/pull/10716))
|
470
|
+
|
471
|
+
### Deprecations
|
472
|
+
|
473
|
+
* Deprecated reset_#{attribute} in favor of restore_#{attribute}.
|
474
|
+
([Pull Request](https://github.com/rails/rails/pull/16180))
|
475
|
+
|
476
|
+
* Deprecated ActiveModel::Dirty#reset_changes in favor of #clear_changes_information.
|
477
|
+
([Pull Request](https://github.com/rails/rails/pull/16180))
|
478
|
+
|
479
|
+
### Notable changes
|
480
|
+
|
481
|
+
* Introduced the `restore_attributes` method in `ActiveModel::Dirty` to restore
|
482
|
+
the changed (dirty) attributes to their previous values.
|
483
|
+
(Pull Request [1](https://github.com/rails/rails/pull/14861), [2](https://github.com/rails/rails/pull/16180))
|
484
|
+
|
485
|
+
* `has_secure_password` no longer disallow blank passwords (i.e. passwords
|
486
|
+
that contains only spaces) by default.
|
487
|
+
([Pull Request](https://github.com/rails/rails/pull/16412))
|
488
|
+
|
489
|
+
* `has_secure_password` now verifies that the given password is less than 72
|
490
|
+
characters if validations are enabled.
|
491
|
+
([Pull Request](https://github.com/rails/rails/pull/15708))
|
492
|
+
|
493
|
+
* Introduced `#validate` as an alias for `#valid?`.
|
494
|
+
([Pull Request](https://github.com/rails/rails/pull/14456))
|
495
|
+
|
496
|
+
|
497
|
+
Active Support
|
498
|
+
--------------
|
499
|
+
|
500
|
+
Please refer to the [Changelog][active-support] for detailed changes.
|
501
|
+
|
502
|
+
### Removals
|
503
|
+
|
504
|
+
* Removed deprecated `Numeric#ago`, `Numeric#until`, `Numeric#since`,
|
505
|
+
`Numeric#from_now`.
|
506
|
+
([Commit](https://github.com/rails/rails/commit/f1eddea1e3f6faf93581c43651348f48b2b7d8bb))
|
507
|
+
|
508
|
+
* Removed deprecated string based terminators for `ActiveSupport::Callbacks`.
|
509
|
+
([Pull Request](https://github.com/rails/rails/pull/15100))
|
510
|
+
|
511
|
+
### Deprecations
|
512
|
+
|
513
|
+
* Deprecated `Kernel#silence_stderr`, `Kernel#capture` and `Kernel#quietly`
|
514
|
+
without replacement.
|
515
|
+
([Pull Request](https://github.com/rails/rails/pull/13392))
|
516
|
+
|
517
|
+
* Deprecated `Class#superclass_delegating_accessor`, use
|
518
|
+
`Class#class_attribute` instead.
|
519
|
+
([Pull Request](https://github.com/rails/rails/pull/14271))
|
520
|
+
|
521
|
+
* Deprecated `ActiveSupport::SafeBuffer#prepend!` as
|
522
|
+
`ActiveSupport::SafeBuffer#prepend` now performs the same function.
|
523
|
+
([Pull Request](https://github.com/rails/rails/pull/14529))
|
524
|
+
|
525
|
+
### Notable changes
|
526
|
+
|
527
|
+
* The `travel_to` test helper now truncates the `usec` component to 0.
|
528
|
+
([Commit](https://github.com/rails/rails/commit/9f6e82ee4783e491c20f5244a613fdeb4024beb5))
|
529
|
+
|
530
|
+
* `ActiveSupport::TestCase` now randomizes the order that test cases are ran
|
531
|
+
by default.
|
532
|
+
([Commit](https://github.com/rails/rails/commit/6ffb29d24e05abbd9ffe3ea974140d6c70221807))
|
533
|
+
|
534
|
+
* Introduced `Object#itself` as an identity function.
|
535
|
+
(Commit [1](https://github.com/rails/rails/commit/702ad710b57bef45b081ebf42e6fa70820fdd810),
|
536
|
+
[2](https://github.com/rails/rails/commit/64d91122222c11ad3918cc8e2e3ebc4b0a03448a))
|
537
|
+
|
538
|
+
* `Object#with_options` can now be used without an explicit receiver.
|
539
|
+
([Pull Request](https://github.com/rails/rails/pull/16339))
|
540
|
+
|
541
|
+
* Introduced `String#truncate_words` to truncate a string by a number of words.
|
542
|
+
([Pull Request](https://github.com/rails/rails/pull/16190))
|
543
|
+
|
544
|
+
* Added `Hash#transform_values` and `Hash#transform_values!` to simplify a
|
545
|
+
common pattern where the values of a hash must change, but the keys are left
|
546
|
+
the same.
|
547
|
+
([Pull Request](https://github.com/rails/rails/pull/15819))
|
548
|
+
|
549
|
+
* The `humanize` inflector helper now strips any leading underscores.
|
550
|
+
([Commit](https://github.com/rails/rails/commit/daaa21bc7d20f2e4ff451637423a25ff2d5e75c7))
|
551
|
+
|
552
|
+
* Introduced `Concern#class_methods` as an alternative to
|
553
|
+
`module ClassMethods`, as well as `Kernel#concern` to avoid the
|
554
|
+
`module Foo; extend ActiveSupport::Concern; end` boilerplate.
|
555
|
+
([Commit](https://github.com/rails/rails/commit/b16c36e688970df2f96f793a759365b248b582ad))
|
556
|
+
|
557
|
+
|
558
|
+
Credits
|
559
|
+
-------
|
560
|
+
|
561
|
+
See the
|
562
|
+
[full list of contributors to Rails](http://contributors.rubyonrails.org/) for
|
563
|
+
the many people who spent many hours making Rails the stable and robust
|
564
|
+
framework it is today. Kudos to all of them.
|
565
|
+
|
566
|
+
[railties]: https://github.com/rails/rails/blob/4-2-stable/railties/CHANGELOG.md
|
567
|
+
[action-pack]: https://github.com/rails/rails/blob/4-2-stable/actionpack/CHANGELOG.md
|
568
|
+
[action-view]: https://github.com/rails/rails/blob/4-2-stable/actionview/CHANGELOG.md
|
569
|
+
[action-mailer]: https://github.com/rails/rails/blob/4-2-stable/actionmailer/CHANGELOG.md
|
570
|
+
[active-record]: https://github.com/rails/rails/blob/4-2-stable/activerecord/CHANGELOG.md
|
571
|
+
[active-model]: https://github.com/rails/rails/blob/4-2-stable/activemodel/CHANGELOG.md
|
572
|
+
[active-support]: https://github.com/rails/rails/blob/4-2-stable/activesupport/CHANGELOG.md
|