CHANGELOG.md in activesupport-4.0.13 vs CHANGELOG.md in activesupport-4.1.0.beta1

- old
+ new

@@ -1,97 +1,5 @@ -## Rails 4.0.13 (January 6, 2015) ## - -*No changes* - - -## Rails 4.0.12 (November 16, 2014) ## - -*No changes* - - -## Rails 4.0.11.1 (November 19, 2014) ## - -*No changes* - - -## Rails 4.0.11 (September 11, 2014) ## - -*No changes* - - -## Rails 4.0.10 (September 11, 2014) ## - -* Fix DateTime comparison with DateTime::Infinity object. - - *Rafael Mendonça França* - -* Make Dependencies pass a name to NameError error. - - *arthurnn*, *Yuki Nishijima* - - -## Rails 4.0.9 (August 18, 2014) ## - -*No changes* - - -## Rails 4.0.8 (July 2, 2014) ## - -*No changes* - - -## Rails 4.0.7 (July 2, 2014) ## - -*No changes* - - -## Rails 4.0.6 (June 26, 2014) ## - -* `Hash#deep_transform_keys` and `Hash#deep_transform_keys!` now transform hashes - in nested arrays. This change also applies to `Hash#deep_stringify_keys`, - `Hash#deep_stringify_keys!`, `Hash#deep_symbolize_keys` and - `Hash#deep_symbolize_keys!`. - - *OZAWA Sakuro* - -* `HashWithIndifferentAccess` better respects `#to_hash` on objects it's - given. In particular `#update`, `#merge`, `#replace` all accept objects - which respond to `#to_hash`, even if those objects are not Hashes directly. - - Currently, if `HashWithIndifferentAccess.new` is given a non-Hash (even if - it responds to `#to_hash`) that object is treated as the default value, - rather than the initial keys and value. Changing that could break existing - code, so it will be updated in 4.2. - - *Peter Jaros* - - -## Rails 4.0.5 (May 6, 2014) ## - -*No changes* - - -## Rails 4.0.4 (March 14, 2014) ## - -* Fix parsing bugs in `XmlMini` - - Symbols or boolean parsing would raise an error for non string values (e.g. - integers). Decimal parsing would fail due to a missing requirement. - - *Birkir A. Barkarson* - -* Re-enable support for iterating over `DateTime` ranges - - Fixes #13667. - - *Prathamesh Sonpatki* - -* Use `remove_possible_method` instead of `remove_method` to avoid - a `NameError` to be thrown on FreeBSD with the `Date` object. - - *Rafael Mendonça França*, *Robin Dupret* - * Default the new `I18n.enforce_available_locales` config to `true`, meaning `I18n` will make sure that all locales passed to it must be declared in the `available_locales` list. To disable it add the following configuration to your application: @@ -101,600 +9,467 @@ This also ensures I18n configuration is properly initialized taking the new option into account, to avoid their deprecations while booting up the app. *Carlos Antonio da Silva*, *Yves Senn* -* Fix file descriptor being leaked on each call to `Kernel.silence_stream`. +* Introduce Module#concerning: a natural, low-ceremony way to separate + responsibilities within a class. - *Mario Visic* + Imported from https://github.com/37signals/concerning#readme -* Fix `slice!` deleting the default value of the hash. + class Todo < ActiveRecord::Base + concerning :EventTracking do + included do + has_many :events + end - *Antonio Santos* + def latest_event + ... + end + private + def some_internal_method + ... + end + end -## Rails 4.0.3 (February 18, 2014) ## + concerning :Trashable do + def trashed? + ... + end -*No changes* + def latest_event + super some_option: true + end + end + end + is equivalent to defining these modules inline, extending them into + concerns, then mixing them in to the class. -## Rails 4.0.2 (December 02, 2013) ## + Inline concerns tame "junk drawer" classes that intersperse many unrelated + class-level declarations, public instance methods, and private + implementation. Coalesce related bits and give them definition. + These are a stepping stone toward future growth & refactoring. -*No changes* + When to move on from an inline concern: + * Encapsulating state? Extract collaborator object. + * Encompassing more public behavior or implementation? Move to separate file. + * Sharing behavior among classes? Move to separate file. + *Jeremy Kemper* -## Rails 4.0.1 (November 01, 2013) ## +* Fix file descriptor being leaked on each call to `Kernel.silence_stream`. -* Disable the ability to iterate over Range of AS::TimeWithZone - due to significant performance issues. + *Mario Visic* - *Bogdan Gusiev* +* Added `Date#all_week/month/quarter/year` for generating date ranges. -* Fix `ActiveSupport::Cache::FileStore#cleanup` to no longer rely on missing `each_key` method. + *Dmitriy Meremyanin* - *Murray Steele* +* Add `Time.zone.yesterday` and `Time.zone.tomorrow`. These follow the + behavior of Ruby's `Date.yesterday` and `Date.tomorrow` but return localized + versions, similar to how `Time.zone.today` has returned a localized version + of `Date.today`. -* Ensure that autoloaded constants in all-caps nestings are marked as - autoloaded. + *Colin Bartlett* - *Simon Coffey* +* Show valid keys when `assert_valid_keys` raises an exception, and show the + wrong value as it was entered. -* Adds a new deprecation behaviour that raises an exception. Throwing this - line into `config/environments/development.rb`: + *Gonzalo Rodríguez-Baltanás Díaz* - ActiveSupport::Deprecation.behavior = :raise +* Both `cattr_*` and `mattr_*` method definitions now live in `active_support/core_ext/module/attribute_accessors`. - will cause the application to raise an `ActiveSupport::DeprecationException` - on deprecations. + Requires to `active_support/core_ext/class/attribute_accessors` are + deprecated and will be removed in Ruby on Rails 4.2. - Use this for aggressive deprecation cleanups. + *Genadi Samokovarov* - *Xavier Noria* +* 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` -* Improve `ActiveSupport::Cache::MemoryStore` cache size calculation. - The memory used by a key/entry pair is calculated via `#cached_size`: + This will help to catch subtle bugs like: - def cached_size(key, entry) - key.to_s.bytesize + entry.size + PER_ENTRY_OVERHEAD + def recent?(days = 3) + self.created_at >= days.ago end - The value of `PER_ENTRY_OVERHEAD` is 240 bytes based on an [empirical - estimation](https://gist.github.com/ssimeonov/6047200) for 64-bit MRI on - 1.9.3 and 2.0. + The above code would check if the model is created within the last 3 **seconds**. - Fixes #11512. + 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. - *Simeon Simeonov* + *Godfrey Chan* -* Only raise `Module::DelegationError` if it's the source of the exception. +* Requires JSON gem version 1.7.7 or above due to a security issue in older versions. - Fixes #10559. + *Godfrey Chan* -* Add `DateTime#usec` and `DateTime#nsec` so that `ActiveSupport::TimeWithZone` keeps - sub-second resolution when wrapping a `DateTime` value. +* Removed the old pure-Ruby JSON encoder and switched to a new encoder based on the built-in JSON + gem. - Fixes #10855. + Support for encoding `BigDecimal` as a JSON number, as well as defining custom `encode_json` + methods to control the JSON output has been **removed from core**. The new encoder will always + encode BigDecimals as `String`s and ignore any custom `encode_json` methods. - *Andrew White* + The old encoder has been extracted into the `activesupport-json_encoder` gem. Installing that + gem will bring back the ability to encode `BigDecimal`s as numbers as well as `encode_json` + support. -* Make `Time.at_with_coercion` retain the second fraction and return local time. + Setting the related configuration `ActiveSupport.encode_big_decimal_as_string` without the + `activesupport-json_encoder` gem installed will raise an error. - Fixes #11350. + *Godfrey Chan* - *Neer Friedman*, *Andrew White* +* 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` to return the + time or date after the difference calculation, or the time or date that got passed into the + method respectively. -* Fix return value from `BacktraceCleaner#noise` when the cleaner is configured - with multiple silencers. + Example for `#travel`: - Fixes #11030. + Time.now # => 2013-11-09 15:34:49 -05:00 + travel 1.day + Time.now # => 2013-11-10 15:34:49 -05:00 + Date.today # => Sun, 10 Nov 2013 - *Mark J. Titorenko* + Example for `#travel_to`: -* Fix `ActiveSupport::Dependencies::Loadable#load_dependency` calling - `#blame_file!` on Exceptions that do not have the Blamable mixin + Time.now # => 2013-11-09 15:34:49 -05:00 + travel_to Time.new(2004, 11, 24, 01, 04, 44) + Time.now # => 2004-11-24 01:04:44 -05:00 + Date.today # => Wed, 24 Nov 2004 - *Andrew Kreiling* + Both of these methods also accept a block, which will return the current time back to its + original state at the end of the block: + Time.now # => 2013-11-09 15:34:49 -05:00 -## Rails 4.0.0 (June 25, 2013) ## + travel 1.day do + User.create.created_at # => Sun, 10 Nov 2013 15:34:49 EST -05:00 + end -* Override `Time.at` to support the passing of Time-like values when called with a single argument. + travel_to Time.new(2004, 11, 24, 01, 04, 44) do + User.create.created_at # => Wed, 24 Nov 2004 01:04:44 EST -05:00 + end - *Andrew White* + Time.now # => 2013-11-09 15:34:49 -05:00 -* Allow Date to be compared with Time (like it was possible to compare Time with Date). + This module is included in `ActiveSupport::TestCase` automatically. - *DHH* + *Prem Sichanugrist*, *DHH* -* Deprecate multiple parameters support of `Object#in?`. +* Unify `cattr_*` interface: allow to pass a block to `cattr_reader`. - *Brian Morearty + Carlos Antonio da Silva* - -* An `ActiveSupport::Subscriber` class has been extracted from - `ActiveSupport::LogSubscriber`, allowing you to use the event attachment - API for other kinds of subscribers. - - *Daniel Schierbeck* - -* `Class#class_attribute` accepts an `instance_predicate` option which - defaults to `true`. If set to `false` the predicate method will not - be defined. - - *Agis Anastasopoulos* - -* `fast_xs` support has been removed. Use `String#encode(xml: :attr)`. - -* `ActiveSupport::Notifications::Instrumenter#instrument` should - yield its payload. - - *stopdropandrew* - -* `ActiveSupport::TimeWithZone` raises `NoMethodError` in proper context. - Fixes #9772. - - *Yves Senn* - -* Fix deletion of empty directories in `ActiveSupport::Cache::FileStore`. - - *Charles Jones* - -* Improve singularizing a singular for multiple cases. - Fixes #2608 #1825 #2395. - Example: - # Before - 'address'.singularize # => 'addres' + class A + cattr_reader(:defr) { 'default_reader_value' } + end + A.defr # => 'default_reader_value' - # After - 'address'.singularize # => 'address' + *Alexey Chernenkov* - *Mark McSpadden* +* Improved compatibility with the stdlib JSON gem. -* Prevent `DateTime#change` from truncating the second fraction, when seconds - do not need to be changed. + Previously, calling `::JSON.{generate,dump}` sometimes causes unexpected + failures such as intridea/multi_json#86. - *Chris Baynes* + `::JSON.{generate,dump}` now bypasses the ActiveSupport JSON encoder + completely and yields the same result with or without ActiveSupport. This + means that it will **not** call `as_json` and will ignore any options that + the JSON gem does not natively understand. To invoke ActiveSupport's JSON + encoder instead, use `obj.to_json(options)` or + `ActiveSupport::JSON.encode(obj, options)`. -* Added `ActiveSupport::TimeWithZone#to_r` for `Time#at` compatibility. + *Godfrey Chan* - Before this change: +* Fix Active Support `Time#to_json` and `DateTime#to_json` to return 3 decimal + places worth of fractional seconds, similar to `TimeWithZone`. - Time.zone = 'Tokyo' - time = Time.zone.now - time == Time.at(time) # => false + *Ryan Glover* - After the change: +* Removed circular reference protection in JSON encoder, deprecated + `ActiveSupport::JSON::Encoding::CircularReferenceError`. - Time.zone = 'Tokyo' - time = Time.zone.now - time == Time.at(time) # => true + *Godfrey Chan*, *Sergio Campamá* - *stopdropandrew* +* Add `capitalize` option to `Inflector.humanize`, so strings can be humanized without being capitalized: -* `ActiveSupport::NumberHelper#number_to_human` returns the number unaltered when - the given units hash does not contain the needed key, e.g. when the number provided - is less than the largest key provided. - Fixes #9269. + 'employee_salary'.humanize # => "Employee salary" + 'employee_salary'.humanize(capitalize: false) # => "employee salary" - Examples: + *claudiob* - number_to_human(123, units: {}) # => 123 - number_to_human(123, units: { thousand: 'k' }) # => 123 +* Fixed `Object#as_json` and `Struct#as_json` not working properly with options. They now take + the same options as `Hash#as_json`: - *Michael Hoffman* + struct = Struct.new(:foo, :bar).new + struct.foo = "hello" + struct.bar = "world" + json = struct.as_json(only: [:foo]) # => {foo: "hello"} -* Added `beginning_of_minute` support to core ext calculations for `Time` and `DateTime`. + *Sergio Campamá*, *Godfrey Chan* - *Gagan Awhad* +* Added `Numeric#in_milliseconds`, like `1.hour.in_milliseconds`, so we can feed them to JavaScript functions like `getTime()`. -* Add `:nsec` date format. - - *Jamie Gaskins* - -* `ActiveSupport::Gzip.compress` allows two optional arguments for compression - level and strategy. - - *Beyond* - -* Modify `TimeWithZone#as_json` to include 3 decimal places of sub-second accuracy - by default, which is optional as per the ISO8601 spec, but extremely useful. Also - the default behaviour of `Date#toJSON()` in recent versions of Chrome, Safari and - Firefox. - - *James Harton* - -* Improve `String#squish` to handle Unicode whitespace. *Antoine Lyset* - -* Standardise on `to_time` returning an instance of `Time` in the local system timezone - across `String`, `Time`, `Date`, `DateTime` and `ActiveSupport::TimeWithZone`. - - *Andrew White* - -* Extract `ActiveSupport::Testing::Performance` into https://github.com/rails/rails-perftest - You can add the gem to your `Gemfile` to keep using performance tests. - - gem 'rails-perftest' - - *Yves Senn* - -* `Hash.from_xml` raises when it encounters `type="symbol"` or `type="yaml"`. - Use `Hash.from_trusted_xml` to parse this XML. - - CVE-2013-0156 - - *Jeremy Kemper* - -* Deprecate `assert_present` and `assert_blank` in favor of - `assert object.blank?` and `assert object.present?` - - *Yves Senn* - -* Change `String#to_date` to use `Date.parse`. This gives more consistent error - messages and allows the use of partial dates. - - "gibberish".to_date => Argument Error: invalid date - "3rd Feb".to_date => Sun, 03 Feb 2013 - - *Kelly Stannard* - -* Remove meaningless `ActiveSupport::FrozenObjectError`, which was just an alias of `RuntimeError`. - - *Akira Matsuda* - -* Introduce `assert_not` to replace warty `assert !foo`. *Jeremy Kemper* - -* Prevent `Callbacks#set_callback` from setting the same callback twice. - - before_save :foo, :bar, :foo - - will at first call `bar`, then `foo`. `foo` will no more be called - twice. - - *Dmitriy Kiriyenko* - -* Add `ActiveSupport::Logger#silence` that works the same as the old `Logger#silence` extension. - *DHH* -* Remove surrogate unicode character encoding from `ActiveSupport::JSON.encode` - The encoding scheme was broken for unicode characters outside the basic multilingual plane; - since json is assumed to be UTF-8, and we already force the encoding to UTF-8, - simply pass through the un-encoded characters. +* Calling `ActiveSupport::JSON.decode` with unsupported options now raises an error. - *Brett Carter* + *Godfrey Chan* -* Deprecate `Time.time_with_date_fallback`, `Time.utc_time` and `Time.local_time`. - These methods were added to handle the limited range of Ruby's native `Time` - implementation. Those limitations no longer apply so we are deprecating them in 4.0 - and they will be removed in 4.1. +* Support `:unless_exist` in `FileStore`. - *Andrew White* + *Michael Grosser* -* Deprecate `Date#to_time_in_current_zone` and add `Date#in_time_zone`. *Andrew White* +* Fix `slice!` deleting the default value of the hash. -* Add `String#in_time_zone` method to convert a string to an `ActiveSupport::TimeWithZone`. *Andrew White* + *Antonio Santos* -* Deprecate `ActiveSupport::BasicObject` in favor of `ActiveSupport::ProxyObject`. - This class is used for proxy classes. It avoids confusion with Ruby's `BasicObject` - class. +* `require_dependency` accepts objects that respond to `to_path`, in + particular `Pathname` instances. - *Francesco Rodriguez* + *Benjamin Fleischer* -* Patched `Marshal#load` to work with constant autoloading. Fixes autoloading - with cache stores that rely on `Marshal` (`MemCacheStore` and `FileStore`). - Fixes #8167. +* Disable the ability to iterate over Range of AS::TimeWithZone + due to significant performance issues. - *Uriel Katz* + *Bogdan Gusiev* -* Make `Time.zone.parse` to work with JavaScript format date strings. *Andrew White* +* Allow attaching event subscribers to ActiveSupport::Notifications namespaces + before they're defined. Essentially, this means instead of this: -* Add `DateTime#seconds_until_end_of_day` and `Time#seconds_until_end_of_day` - as a complement for `seconds_from_midnight`; useful when setting expiration - times for caches, e.g.: + class JokeSubscriber < ActiveSupport::Subscriber + def sql(event) + puts "A rabbi and a priest walk into a bar..." + end - <% cache('dashboard', expires_in: Date.current.seconds_until_end_of_day) do %> - ... + # This call needs to happen *after* defining the methods. + attach_to "active_record" + end - *Olek Janiszewski* + You can do this: -* No longer proxy `ActiveSupport::Multibyte#class`. *Steve Klabnik* + class JokeSubscriber < ActiveSupport::Subscriber + # This is much easier to read! + attach_to "active_record" -* Deprecate `ActiveSupport::TestCase#pending` method, use `skip` from minitest instead. *Carlos Antonio da Silva* - -* `XmlMini.with_backend` now may be safely used with threads: - - Thread.new do - XmlMini.with_backend("REXML") { rexml_power } + def sql(event) + puts "A rabbi and a priest walk into a bar..." + end end - Thread.new do - XmlMini.with_backend("LibXML") { libxml_power } - end - Each thread will use it's own backend. + This should make it easier to read and understand these subscribers. - *Nikita Afanasenko* + *Daniel Schierbeck* -* Dependencies no longer trigger `Kernel#autoload` in `remove_constant`. Fixes #8213. *Xavier Noria* +* Add `Date#middle_of_day`, `DateTime#middle_of_day` and `Time#middle_of_day` methods. -* Simplify `mocha` integration and remove monkey-patches, bumping `mocha` to 0.13.0. *James Mead* + Also added `midday`, `noon`, `at_midday`, `at_noon` and `at_middle_of_day` as aliases. -* `#as_json` isolates options when encoding a hash. Fixes #8182. + *Anatoli Makarevich* - *Yves Senn* +* Fix ActiveSupport::Cache::FileStore#cleanup to no longer rely on missing each_key method. -* Deprecate `Hash#diff` in favor of minitest's #diff. *Steve Klabnik* + *Murray Steele* -* `Kernel#capture` can catch output from subprocesses. *Dmitry Vorotilin* +* Ensure that autoloaded constants in all-caps nestings are marked as + autoloaded. -* `to_xml` conversions now use builder's `tag!` method instead of explicit invocation of `method_missing`. + *Simon Coffey* - *Nikita Afanasenko* +* Add `String#remove(pattern)` as a short-hand for the common pattern of + `String#gsub(pattern, '')`. -* Fixed timezone mapping of the Solomon Islands. *Steve Klabnik* + *DHH* -* Make callstack attribute optional in `ActiveSupport::Deprecation::Reporting` - methods `warn` and `deprecation_warning`. +* Adds a new deprecation behaviour that raises an exception. Throwing this + line into +config/environments/development.rb+ - *Alexey Gaziev* + ActiveSupport::Deprecation.behavior = :raise -* Implement `HashWithIndifferentAccess#replace` so `key?` works correctly. *David Graham* + will cause the application to raise an +ActiveSupport::DeprecationException+ + on deprecations. -* Handle the possible permission denied errors `atomic.rb` might trigger due to its `chown` - and `chmod` calls. + Use this for aggressive deprecation cleanups. - *Daniele Sluijters* + *Xavier Noria* -* `Hash#extract!` returns only those keys that present in the receiver. +* Remove 'cow' => 'kine' irregular inflection from default inflections. - {a: 1, b: 2}.extract!(:a, :x) # => {:a => 1} + *Andrew White* - *Mikhail Dieterle* +* Add `DateTime#to_s(:iso8601)` and `Date#to_s(:iso8601)` for consistency. -* `Hash#extract!` returns the same subclass, that the receiver is. I.e. - `HashWithIndifferentAccess#extract!` returns a `HashWithIndifferentAccess` instance. + *Andrew White* - *Mikhail Dieterle* +* Add `Time#to_s(:iso8601)` for easy conversion of times to the iso8601 format for easy Javascript date parsing. -* Optimize `ActiveSupport::Cache::Entry` to reduce memory and processing overhead. *Brian Durand* + *DHH* -* Tests tag the Rails log with the current test class and test case: +* Improve `ActiveSupport::Cache::MemoryStore` cache size calculation. + The memory used by a key/entry pair is calculated via `#cached_size`: - [SessionsControllerTest] [test_0002_sign in] Processing by SessionsController#create as HTML - [SessionsControllerTest] [test_0002_sign in] ... - - *Jeremy Kemper* - -* Add `logger.push_tags` and `.pop_tags` to complement `logger.tagged`: - - class Job - def before - Rails.logger.push_tags :jobs, self.class.name - end - - def after - Rails.logger.pop_tags 2 - end + def cached_size(key, entry) + key.to_s.bytesize + entry.size + PER_ENTRY_OVERHEAD end - *Jeremy Kemper* + The value of `PER_ENTRY_OVERHEAD` is 240 bytes based on an [empirical + estimation](https://gist.github.com/ssimeonov/6047200) for 64-bit MRI on + 1.9.3 and 2.0. GH#11512 -* Allow delegation to the class using the `:class` keyword, replacing - `self.class` usage: + *Simeon Simeonov* - class User - def self.hello - "world" - end +* Only raise `Module::DelegationError` if it's the source of the exception. - delegate :hello, to: :class - end + Fixes #10559 - *Marc-Andre Lafortune* + *Andrew White* -* `Date.beginning_of_week` thread local and `beginning_of_week` application - config option added (default is Monday). +* Make `Time.at_with_coercion` retain the second fraction and return local time. - *Innokenty Mikhailov* + Fixes #11350 -* An optional block can be passed to `config_accessor` to set its default value + *Neer Friedman*, *Andrew White* - class User - include ActiveSupport::Configurable +* Make `HashWithIndifferentAccess#select` always return the hash, even when + `Hash#select!` returns `nil`, to allow further chaining. - config_accessor :hair_colors do - [:brown, :black, :blonde, :red] - end - end + *Marc Schütz* - User.hair_colors # => [:brown, :black, :blonde, :red] +* Remove deprecated `String#encoding_aware?` core extensions (`core_ext/string/encoding`). - *Larry Lv* + *Arun Agrawal* -* `ActiveSupport::Benchmarkable#silence` has been deprecated due to its lack of - thread safety. It will be removed without replacement in Rails 4.1. +* Remove deprecated `Module#local_constant_names` in favor of `Module#local_constants`. - *Steve Klabnik* + *Arun Agrawal* -* An optional block can be passed to `Hash#deep_merge`. The block will be invoked - for each duplicated key and used to resolve the conflict. +* Remove deprecated `DateTime.local_offset` in favor of `DateTime.civil_from_fromat`. - *Pranas Kiziela* + *Arun Agrawal* -* `ActiveSupport::Deprecation` is now a class. It is possible to create an instance - of deprecator. Backwards compatibility has been preserved. +* Remove deprecated `Logger` core extensions (`core_ext/logger.rb`). - You can choose which instance of the deprecator will be used. + *Carlos Antonio da Silva* - deprecate :method_name, deprecator: deprecator_instance +* Remove deprecated `Time#time_with_datetime_fallback`, `Time#utc_time` + and `Time#local_time` in favor of `Time#utc` and `Time#local`. - You can use `ActiveSupport::Deprecation` in your gem. + *Vipul A M* - require 'active_support/deprecation' - require 'active_support/core_ext/module/deprecation' +* Remove deprecated `Hash#diff` with no replacement. - class MyGem - def self.deprecator - ActiveSupport::Deprecation.new('2.0', 'MyGem') - end + If you're using it to compare hashes for the purpose of testing, please use + MiniTest's `assert_equal` instead. - def old_method - end + *Carlos Antonio da Silva* - def new_method - end +* Remove deprecated `Date#to_time_in_current_zone` in favor of `Date#in_time_zone`. - deprecate old_method: :new_method, deprecator: deprecator - end + *Vipul A M* - MyGem.new.old_method - # => DEPRECATION WARNING: old_method is deprecated and will be removed from MyGem 2.0 (use new_method instead). (called from <main> at file.rb:18) +* Remove deprecated `Proc#bind` with no replacement. - *Piotr Niełacny & Robert Pankowecki* + *Carlos Antonio da Silva* -* `ERB::Util.html_escape` encodes single quote as `#39`. Decimal form has better support in old browsers. *Kalys Osmonov* +* Remove deprecated `Array#uniq_by` and `Array#uniq_by!`, use native + `Array#uniq` and `Array#uniq!` instead. -* `ActiveSupport::Callbacks`: deprecate monkey patch of object callbacks. - Using the `filter` method like this: + *Carlos Antonio da Silva* - before_filter MyFilter.new +* Remove deprecated `ActiveSupport::BasicObject`, use `ActiveSupport::ProxyObject` instead. - class MyFilter - def filter(controller) - end - end - - Is now deprecated with recommendation to use the corresponding filter type - (`#before`, `#after` or `#around`): - - before_filter MyFilter.new - - class MyFilter - def before(controller) - end - end - - *Bogdan Gusiev* - -* An optional block can be passed to `HashWithIndifferentAccess#update` and `#merge`. - The block will be invoked for each duplicated key, and used to resolve the conflict, - thus replicating the behaviour of the corresponding methods on the `Hash` class. - - *Leo Cassarani* - -* Remove `j` alias for `ERB::Util#json_escape`. - The `j` alias is already used for `ActionView::Helpers::JavaScriptHelper#escape_javascript` - and both modules are included in the view context that would confuse the developers. - - *Akira Matsuda* - -* Replace deprecated `memcache-client` gem with `dalli` in `ActiveSupport::Cache::MemCacheStore`. - - *Guillermo Iguaran* - -* Add default values to all `ActiveSupport::NumberHelper` methods, to avoid - errors with empty locales or missing values. - *Carlos Antonio da Silva* -* `ActiveSupport::JSON::Variable` is deprecated. Define your own `#as_json` and - `#encode_json` methods for custom JSON string literals. +* Remove deprecated `BufferedLogger`, use `ActiveSupport::Logger` instead. - *Erich Menge* + *Yves Senn* -* Add `String#indent`. *fxn & Ace Suares* +* Remove deprecated `assert_present` and `assert_blank` methods, use `assert + object.blank?` and `assert object.present?` instead. -* Inflections can now be defined per locale. `singularize` and `pluralize` - accept locale as an extra argument. + *Yves Senn* - *David Celis* +* Fix return value from `BacktraceCleaner#noise` when the cleaner is configured + with multiple silencers. -* `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!`. + Fixes #11030 - *DHH* + *Mark J. Titorenko* -* `ERB::Util.html_escape` now escapes single quotes. *Santiago Pastorino* +* `HashWithIndifferentAccess#select` now returns a `HashWithIndifferentAccess` + instance instead of a `Hash` instance. -* `Time#change` now works with time values with offsets other than UTC or the local time zone. *Andrew White* + Fixes #10723 -* `ActiveSupport::Callbacks`: deprecate usage of filter object with `#before` and `#after` methods as `around` callback. *Bogdan Gusiev* + *Albert Llop* -* Add `Time#prev_quarter` and `Time#next_quarter` short-hands for `months_ago(3)` and `months_since(3)`. *SungHee Kang* +* Add `DateTime#usec` and `DateTime#nsec` so that `ActiveSupport::TimeWithZone` keeps + sub-second resolution when wrapping a `DateTime` value. -* Remove obsolete and unused `require_association` method from dependencies. *fxn* + Fixes #10855 -* Add `:instance_accessor` option for `config_accessor`. + *Andrew White* - class User - include ActiveSupport::Configurable - config_accessor :allowed_access, instance_accessor: false - end +* Fix `ActiveSupport::Dependencies::Loadable#load_dependency` calling + `#blame_file!` on Exceptions that do not have the Blamable mixin - User.new.allowed_access = true # => NoMethodError - User.new.allowed_access # => NoMethodError + *Andrew Kreiling* - *Francesco Rodriguez* +* Override `Time.at` to support the passing of Time-like values when called with a single argument. -* `ActionView::Helpers::NumberHelper` methods have been moved to `ActiveSupport::NumberHelper` and are now available via - `Numeric#to_s`. `Numeric#to_s` now accepts the formatting options `:phone`, `:currency`, `:percentage`, `:delimited`, - `:rounded`, `:human`, and `:human_size`. + *Andrew White* - *Andrew Mutz* +* Prevent side effects to hashes inside arrays when + `Hash#with_indifferent_access` is called. -* Add `Hash#transform_keys`, `Hash#transform_keys!`, `Hash#deep_transform_keys`, and `Hash#deep_transform_keys!`. *Mark McSpadden* + Fixes #10526 -* Changed XML type `datetime` to `dateTime` (with upper case letter `T`). *Angelo Capilleri* + *Yves Senn* -* Add `:instance_accessor` option for `class_attribute`. *Alexey Vakhov* +* Removed deprecated `ActiveSupport::JSON::Variable` with no replacement. -* `constantize` now looks in the ancestor chain. *Marc-Andre Lafortune & Andrew White* + *Toshinori Kajihara* -* Adds `Hash#deep_stringify_keys` and `Hash#deep_stringify_keys!` to convert all keys from a `Hash` instance into strings. *Lucas Húngaro* +* Raise an error when multiple `included` blocks are defined for a Concern. + The old behavior would silently discard previously defined blocks, running + only the last one. -* Adds `Hash#deep_symbolize_keys` and `Hash#deep_symbolize_keys!` to convert all keys from a `Hash` instance into symbols. *Lucas Húngaro* + *Mike Dillon* -* `Object#try` can't call private methods. *Vasiliy Ermolovich* +* Replace `multi_json` with `json`. -* `AS::Callbacks#run_callbacks` remove `key` argument. *Francesco Rodriguez* + Since Rails requires Ruby 1.9 and since Ruby 1.9 includes `json` in the standard library, + `multi_json` is no longer necessary. -* `deep_dup` works more expectedly now and duplicates also values in `Hash` instances and elements in `Array` instances. *Alexey Gaziev* + *Erik Michaels-Ober* -* Inflector no longer applies ice -> ouse to words like "slice", "police", etc. *Wes Morgan* +* Added escaping of U+2028 and U+2029 inside the json encoder. + These characters are legal in JSON but break the Javascript interpreter. + After escaping them, the JSON is still legal and can be parsed by Javascript. -* Add `ActiveSupport::Deprecations.behavior = :silence` to completely ignore Rails runtime deprecations. *twinturbo* + *Mario Caropreso + Viktor Kelemen + zackham* -* Make `Module#delegate` stop using `send` - can no longer delegate to private methods. *dasch* +* Fix skipping object callbacks using metadata fetched via callback chain + inspection methods (`_*_callbacks`) -* `ActiveSupport::Callbacks`: deprecate `:rescuable` option. *Bogdan Gusiev* + *Sean Walbran* -* Adds `Integer#ordinal` to get the ordinal suffix string of an integer. *Tim Gildea* +* Add a `fetch_multi` method to the cache stores. The method provides + an easy to use API for fetching multiple values from the cache. -* `ActiveSupport::Callbacks`: `:per_key` option is no longer supported. *Bogdan Gusiev* + Example: -* `ActiveSupport::Callbacks#define_callbacks`: add `:skip_after_callbacks_if_terminated` option. *Bogdan Gusiev* + # Calculating scores is expensive, so we only do it for posts + # that have been updated. Cache keys are automatically extracted + # from objects that define a #cache_key method. + scores = Rails.cache.fetch_multi(*posts) do |post| + calculate_score(post) + end -* Add `html_escape_once` to `ERB::Util`, and delegate the `escape_once` tag helper to it. *Carlos Antonio da Silva* + *Daniel Schierbeck* -* Deprecates the compatibility method `Module#local_constant_names`, - use `Module#local_constants` instead (which returns symbols). *Xavier Noria* - -* Deletes the compatibility method `Module#method_names`, - use `Module#methods` from now on (which returns symbols). *Xavier Noria* - -* Deletes the compatibility method `Module#instance_method_names`, - use `Module#instance_methods` from now on (which returns symbols). *Xavier Noria* - -* `BufferedLogger` is deprecated. Use `ActiveSupport::Logger`, or the logger - from the Ruby standard library. - - *Aaron Patterson* - -* Unicode database updated to 6.1.0. *Norman Clarke* - -* Adds `encode_big_decimal_as_string` option to force JSON serialization of `BigDecimal` as numeric instead - of wrapping them in strings for safety. - -* Optimize log subscribers to check log level before doing any processing. *Brian Durand* - -Please check [3-2-stable](https://github.com/rails/rails/blob/3-2-stable/activesupport/CHANGELOG.md) for previous changes. +Please check [4-0-stable](https://github.com/rails/rails/blob/4-0-stable/activesupport/CHANGELOG.md) for previous changes.