提交 7c6d99e8 编写于 作者: Y Yves Senn

first pass through CHANGELOGS to extract 4_1_release_notes. [ci skip]

Extract **notable changes**, **deprecations** and **removals** from
each CHANGELOG.

I tried to reference the commits and pull requests for new features
and deprecations.

In the process I also made some minor changes to the CHANGELOGS.

The 4_1_release_notes guide is declared WIP.
上级 8c944dea
......@@ -130,10 +130,6 @@
*Vasiliy Ermolovich*
* Separate Action View completely from Action Pack.
*Łukasz Strzałkowski*
* Development mode exceptions are rendered in text format in case of XHR request.
*Kir Shatrov*
......@@ -234,7 +230,7 @@
*Yves Senn*, *Andrew White*
* ActionView extracted from ActionPack.
* Action View extracted from Action Pack.
*Piotr Sarnacki*, *Łukasz Strzałkowski*
......
......@@ -7,7 +7,7 @@
*William Myers*
* Added new API methods `reset_changes` and `changed_applied` to `ActiveModel::Dirty`
* Added new API methods `reset_changes` and `changes_applied` to `ActiveModel::Dirty`
that control changes state. Previsously you needed to update internal
instance variables, but now API methods are available.
......@@ -23,7 +23,7 @@
for non-numerical ones.
Fixes range validations like `:a..:f` that used to pass with values like `:be`.
Fixes #10593
Fixes #10593.
*Charles Bergeron*
......
......@@ -23,7 +23,6 @@
*Brian Thomas Storti*
* Fix validation on uniqueness of empty association.
*Evgeny Li*
......@@ -850,7 +849,7 @@
class Author < ActiveRecord::Base
has_many :posts
has_many :taggings, :through => :posts
has_many :taggings, through: :posts
end
class Post < ActiveRecord::Base
......@@ -865,7 +864,7 @@
class Author < ActiveRecord::Base
has_many :posts
has_many :taggings, :through => :posts, :source => :tagging
has_many :taggings, through: :posts, source: :tagging
end
class Post < ActiveRecord::Base
......
* Deprecated Numeric#{ago,until,since,from_now}, the user is expected to explicitly
convert the value into an AS::Duration, i.e. 5.ago => 5.seconds.ago
* Deprecated `Numeric#{ago,until,since,from_now}`, the user is expected to explicitly
convert the value into an AS::Duration, i.e. `5.ago` => `5.seconds.ago`
This will help to catch subtle bugs like:
def recent?(days = 3)
self.created_at >= days.ago
end
def recent?(days = 3)
self.created_at >= days.ago
end
The above code would check if the model is created within the last 3 **seconds**.
In the future, Numeric#{ago,until,since,from_now} should be removed completely,
In the future, `Numeric#{ago,until,since,from_now}` should be removed completely,
or throw some sort of errors to indicate there are no implicit conversion from
Numeric to AS::Duration.
......@@ -177,7 +177,8 @@
*Simon Coffey*
* Add String#remove(pattern) as a short-hand for the common pattern of String#gsub(pattern, '')
* Add `String#remove(pattern)` as a short-hand for the common pattern of
`String#gsub(pattern, '')`.
*DHH*
......@@ -280,11 +281,12 @@
*Carlos Antonio da Silva*
* Remove deprecated `BufferedLogger`.
* Remove deprecated `BufferedLogger`, use `ActiveSupport::Logger` instead.
*Yves Senn*
* Remove deprecated `assert_present` and `assert_blank` methods.
* Remove deprecated `assert_present` and `assert_blank` methods, use `assert
object.blank?` and `assert object.present?` instead.
*Yves Senn*
......
......@@ -3,8 +3,7 @@ Ruby on Rails 4.1 Release Notes
Highlights in Rails 4.1:
* ...
* ...
* Action View extracted from Action Pack
These release notes cover only the major changes. To know about various bug
fixes and changes, please refer to the change logs or check out the
......@@ -75,8 +74,29 @@ Please refer to the
[Changelog](https://github.com/rails/rails/blob/4-1-stable/railties/CHANGELOG.md)
for detailed changes.
### Removals
* Removed `update:application_controller` rake task.
* Removed deprecated `Rails.application.railties.engines`.
* Removed deprecated threadsafe! from Rails Config.
* Remove deprecated `ActiveRecord::Generators::ActiveModel#update_attributes` in
favor of `ActiveRecord::Generators::ActiveModel#update`
* Remove deprecated `config.whiny_nils` option
* Removed deprecated rake tasks for running tests: `rake test:uncommitted` and
`rake test:recent`.
### Notable changes
* `BACKTRACE` environment variable to show unfiltered backtraces for test
failures. ([Commit](https://github.com/rails/rails/commit/84eac5dab8b0fe9ee20b51250e52ad7bfea36553))
* Expose MiddlewareStack#unshift to environment configuration. ([Pull Request](https://github.com/rails/rails/pull/12479))
Action Mailer
-------------
......@@ -87,6 +107,9 @@ for detailed changes.
### Notable changes
* Instrument the generation of Action Mailer messages. The time it takes to
generate a message is written to the log. ([Pull Request](https://github.com/rails/rails/pull/12556))
Active Model
------------
......@@ -95,8 +118,16 @@ Please refer to the
[Changelog](https://github.com/rails/rails/blob/4-1-stable/activemodel/CHANGELOG.md)
for detailed changes.
### Deprecations
* Deprecate `Validator#setup`. This should be done manually now in the
validator's constructor. ([Commit](https://github.com/rails/rails/commit/7d84c3a2f7ede0e8d04540e9c0640de7378e9b3a))
### Notable changes
* Added new API methods `reset_changes` and `changes_applied` to
`ActiveModel::Dirty` that control changes state.
Active Support
--------------
......@@ -105,8 +136,64 @@ Please refer to the
[Changelog](https://github.com/rails/rails/blob/4-1-stable/activesupport/CHANGELOG.md)
for detailed changes.
### Removals
* Remove deprecated `String#encoding_aware?` core extensions (`core_ext/string/encoding`).
* Remove deprecated `Module#local_constant_names` in favor of `Module#local_constants`.
* Remove deprecated `DateTime.local_offset` in favor of `DateTime.civil_from_fromat`.
* Remove deprecated `Logger` core extensions (`core_ext/logger.rb`).
* Remove deprecated `Time#time_with_datetime_fallback`, `Time#utc_time` and
`Time#local_time` in favor of `Time#utc` and `Time#local`.
* Remove deprecated `Hash#diff` with no replacement.
* Remove deprecated `Date#to_time_in_current_zone` in favor of `Date#in_time_zone`.
* Remove deprecated `Proc#bind` with no replacement.
* Remove deprecated `Array#uniq_by` and `Array#uniq_by!`, use native
`Array#uniq` and `Array#uniq!` instead.
* Remove deprecated `ActiveSupport::BasicObject`, use
`ActiveSupport::ProxyObject` instead.
* Remove deprecated `BufferedLogger`, use `ActiveSupport::Logger` instead.
* Remove deprecated `assert_present` and `assert_blank` methods, use `assert
object.blank?` and `assert object.present?` instead.
### Deprecations
* Deprecated `Numeric#{ago,until,since,from_now}`, the user is expected to
explicitly convert the value into an AS::Duration, i.e. `5.ago` => `5.seconds.ago`
([Pull Request](https://github.com/rails/rails/pull/12389))
### Notable changes
* Add `ActiveSupport::Testing::TimeHelpers#travel` and `#travel_to`. These
methods change current time to the given time or time difference by stubbing
`Time.now` and
`Date.today`. ([Pull Request](https://github.com/rails/rails/pull/12824))
* Added `Numeric#in_milliseconds`, like `1.hour.in_milliseconds`, so we can feed
them to JavaScript functions like
`getTime()`. ([Commit](https://github.com/rails/rails/commit/423249504a2b468d7a273cbe6accf4f21cb0e643))
* Add `Date#middle_of_day`, `DateTime#middle_of_day` and `Time#middle_of_day`
methods. Also added `midday`, `noon`, `at_midday`, `at_noon` and
`at_middle_of_day` as
aliases. ([Pull Request](https://github.com/rails/rails/pull/10879))
* Add `String#remove(pattern)` as a short-hand for the common pattern of
`String#gsub(pattern,'')`. ([Commit](https://github.com/rails/rails/commit/5da23a3f921f0a4a3139495d2779ab0d3bd4cb5f))
* Remove 'cow' => 'kine' irregular inflection from default
inflections. ([Commit](https://github.com/rails/rails/commit/c300dca9963bda78b8f358dbcb59cabcdc5e1dc9))
Action Pack
-----------
......@@ -115,8 +202,36 @@ Please refer to the
[Changelog](https://github.com/rails/rails/blob/4-1-stable/actionpack/CHANGELOG.md)
for detailed changes.
### Removals
* Remove deprecated Rails application fallback for integration testing, set
`ActionDispatch.test_app` instead.
* Remove deprecated `page_cache_extension` config.
* Remove deprecated constants from Action Controller:
ActionController::AbstractRequest => ActionDispatch::Request
ActionController::Request => ActionDispatch::Request
ActionController::AbstractResponse => ActionDispatch::Response
ActionController::Response => ActionDispatch::Response
ActionController::Routing => ActionDispatch::Routing
ActionController::Integration => ActionDispatch::Integration
ActionController::IntegrationTest => ActionDispatch::IntegrationTest
### Notable changes
* Take a hash with options inside array in
`#url_for`. ([Pull Request](https://github.com/rails/rails/pull/9599))
* Add `session#fetch` method fetch behaves similarly to
[Hash#fetch](http://www.ruby-doc.org/core-1.9.3/Hash.html#method-i-fetch),
with the exception that the returned value is always saved into the
session. ([Pull Request](https://github.com/rails/rails/pull/12692))
* Separate Action View completely from Action
Pack. ([Pull Request](https://github.com/rails/rails/pull/11032))
Active Record
-------------
......@@ -125,8 +240,148 @@ Please refer to the
[Changelog](https://github.com/rails/rails/blob/4-1-stable/activerecord/CHANGELOG.md)
for detailed changes.
### Removals
* Remove deprecated nil-passing to the following `SchemaCache` methods:
`primary_keys`, `tables`, `columns` and `columns_hash`.
* Remove deprecated block filter from `ActiveRecord::Migrator#migrate`.
* Remove deprecated String constructor from `ActiveRecord::Migrator`.
* Remove deprecated `scope` use without passing a callable object.
* Remove deprecated `transaction_joinable=` in favor of `begin_transaction`
with `:joinable` option.
* Remove deprecated `decrement_open_transactions`.
* Remove deprecated `increment_open_transactions`.
* Remove deprecated `PostgreSQLAdapter#outside_transaction?`
method. You can use `#transaction_open?` instead.
* Remove deprecated `ActiveRecord::Fixtures.find_table_name` in favor of
`ActiveRecord::Fixtures.default_fixture_model_name`.
* Removed deprecated `columns_for_remove` from `SchemaStatements`.
* Remove deprecated `SchemaStatements#distinct`.
* Move deprecated `ActiveRecord::TestCase` into the rails test
suite. The class is no longer public and is only used for internal
Rails tests.
* Removed support for deprecated option `:restrict` for `:dependent`
in associations.
* Removed support for deprecated `delete_sql` in associations.
* Removed support for deprecated `insert_sql` in associations.
* Removed support for deprecated `finder_sql` in associations.
* Removed support for deprecated `counter_sql` in associations.
* Removed deprecated method `type_cast_code` from Column.
* Removed deprecated options `delete_sql` and `insert_sql` from HABTM
association.
* Removed deprecated options `finder_sql` and `counter_sql` from
collection association.
* Remove deprecated `ActiveRecord::Base#connection` method.
Make sure to access it via the class.
* Remove deprecation warning for `auto_explain_threshold_in_seconds`.
* Remove deprecated `:distinct` option from `Relation#count`.
* Removed deprecated methods `partial_updates`, `partial_updates?` and
`partial_updates=`.
* Removed deprecated method `scoped`
* Removed deprecated method `default_scopes?`
* Remove implicit join references that were deprecated in 4.0.
* Remove `activerecord-deprecated_finders` as a dependency
* Usage of `implicit_readonly` is being removed`. Please use `readonly` method
explicitly to mark records as
`readonly. ([Pull Request](https://github.com/rails/rails/pull/10769))
### Deprecations
* Deprecate `quoted_locking_column` method, which isn't used anywhere.
* Deprecate the delegation of Array bang methods for associations.
To use them, instead first call `#to_a` on the association to access the
array to be acted
on. ([Pull Request](https://github.com/rails/rails/pull/12129))
* Deprecate `ConnectionAdapters::SchemaStatements#distinct`,
as it is no longer used by internals. ([Pull Request](https://github.com/rails/rails/pull/10556))
### Notable changes
* Added `ActiveRecord::Base.to_param` for convenient "pretty" URLs derived from
a model's attribute or
method. ([Pull Request](https://github.com/rails/rails/pull/12891))
* Added `ActiveRecord::Base.no_touching`, which allows ignoring touch on
models. ([Pull Request](https://github.com/rails/rails/pull/12772))
* Unify boolean type casting for `MysqlAdapter` and `Mysql2Adapter`.
`type_cast` will return `1` for `true` and `0` for `false`. ([Pull Request](https://github.com/rails/rails/pull/12425))
* `.unscope` now removes conditions specified in
`default_scope`. ([Commit](https://github.com/rails/rails/commit/94924dc32baf78f13e289172534c2e71c9c8cade))
* Added `ActiveRecord::QueryMethods#rewhere` which will overwrite an existing,
named where condition. ([Commit](https://github.com/rails/rails/commit/f950b2699f97749ef706c6939a84dfc85f0b05f2))
* Extend `ActiveRecord::Base#cache_key` to take an optional list of timestamp
attributes of which the highest will be used. ([Commit](https://github.com/rails/rails/commit/e94e97ca796c0759d8fcb8f946a3bbc60252d329))
* Added `ActiveRecord::Base#enum` for declaring enum attributes where the values
map to integers in the database, but can be queried by
name. ([Commit](https://github.com/rails/rails/commit/db41eb8a6ea88b854bf5cd11070ea4245e1639c5))
* Type cast json values on write, so that the value is consistent with reading
from the database. ([Pull Request](https://github.com/rails/rails/pull/12643))
* Type cast hstore values on write, so that the value is consistent
with reading from the database. ([Commit](https://github.com/rails/rails/commit/5ac2341fab689344991b2a4817bd2bc8b3edac9d))
* Make `next_migration_number` accessible for third party
generators. ([Pull Request](https://github.com/rails/rails/pull/12407))
* Calling `update_attributes` will now throw an `ArgumentError` whenever it
gets a `nil` argument. More specifically, it will throw an error if the
argument that it gets passed does not respond to to
`stringify_keys`. ([Pull Request](https://github.com/rails/rails/pull/9860))
* `CollectionAssociation#first`/`#last` (e.g. `has_many`) use a `LIMIT`ed
query to fetch results rather than loading the entire
collection. ([Pull Request](https://github.com/rails/rails/pull/12137))
* `inspect` on Active Record model classes does not initiate a new
connection. This means that calling `inspect`, when the database is missing,
will no longer raise an exception. ([Pull Request](https://github.com/rails/rails/pull/11014))
* Remove column restrictions for `count`, let the database raise if the SQL is
invalid. ([Pull Request](https://github.com/rails/rails/pull/10710))
* Rails now automatically detects inverse associations. If you do not set the
`:inverse_of` option on the association, then Active Record will guess the
inverse association based on heuristics. ([Pull Request](https://github.com/rails/rails/pull/10886))
* Handle aliased attributes in ActiveRecord::Relation. When using symbol keys,
ActiveRecord will now translate aliased attribute names to the actual column
name used in the database. ([Pull Request](https://github.com/rails/rails/pull/7839))
Credits
-------
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册