CHANGELOG.md in activesupport-3.2.22.5 vs CHANGELOG.md in activesupport-4.0.0.beta1

- old
+ new

@@ -1,131 +1,236 @@ -## Rails 3.2.22 (Jun 16, 2015) ## +## Rails 4.0.0.beta1 (February 25, 2013) ## -* Fix denial of service vulnerability in the XML processing. +* Prevent `DateTime#change` from truncating the second fraction, when seconds + do not need to be changed. - CVE-2015-3227. + *Chris Baynes* - *Aaron Patterson* +* Added `ActiveSupport::TimeWithZone#to_r` for `Time#at` compatibility. + Before this change: -## Rails 3.2.19 (Jul 2, 2014) ## + Time.zone = 'Tokyo' + time = Time.zone.now + time == Time.at(time) # => false -* Make sure Active Support configurations are applied correctly. + After the change: - Before this change configuration set using `config.active_support` - would not be set. + Time.zone = 'Tokyo' + time = Time.zone.now + time == Time.at(time) # => true - *Rafael Mendonça França* + *stopdropandrew* +* `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. -## Rails 3.2.18 (May 6, 2014) ## + Examples: -* No changes. + number_to_human(123, units: {}) # => 123 + number_to_human(123, units: { thousand: 'k' }) # => 123 + *Michael Hoffman* -## Rails 3.2.17 (Feb 18, 2014) ## +* Added `beginning_of_minute` support to core ext calculations for `Time` and `DateTime`. -* No changes. + *Gagan Awhad* +* Add `:nsec` date format. -## Rails 3.2.16 (Dec 3, 2013) ## + *Jamie Gaskins* -* No changes. +* `ActiveSupport::Gzip.compress` allows two optional arguments for compression + level and strategy. + *Beyond* -## Rails 3.2.15 (Oct 16, 2013) ## +* 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. -* Fix ActiveSupport::Cache::FileStore#cleanup to no longer rely on missing each_key method. + *James Harton* - *Murray Steele* +* Improve `String#squish` to handle Unicode whitespace. *Antoine Lyset* -* Add respond_to_missing? for TaggedLogging which is best practice when overriding method_missing. This permits - wrapping TaggedLogging by another log abstraction such as em-logger. +* Standardise on `to_time` returning an instance of `Time` in the local system timezone + across `String`, `Time`, `Date`, `DateTime` and `ActiveSupport::TimeWithZone`. - *Wolfram Arnold* + *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. -## Rails 3.2.14 (Jul 22, 2013) ## + gem 'rails-perftest' -* Make `Time.at_with_coercion` retain the second fraction and return local time. + *Yves Senn* - Fixes #11350 +* `Hash.from_xml` raises when it encounters `type="symbol"` or `type="yaml"`. + Use `Hash.from_trusted_xml` to parse this XML. - *Neer Friedman*, *Andrew White* + CVE-2013-0156 -* Fix `ActiveSupport::TaggedLogging` incorrectly providing program name the same as log message - even when block is not provided. + *Jeremy Kemper* - *Carson Reinke* +* Deprecate `assert_present` and `assert_blank` in favor of + `assert object.blank?` and `assert object.present?` -* Override `Time.at` to support the passing of Time-like values when called with a single argument. + *Yves Senn* - *Andrew White* +* Change `String#to_date` to use `Date.parse`. This gives more consistent error + messages and allows the use of partial dates. -* Revert the changes on unicode character encoding from `ActiveSupport::JSON.encode`. - This was causing a regression where the resulting string is always returning UTF-8. - Also it changes the behavior of this method on a stable release. - Fixes #9498. + "gibberish".to_date => Argument Error: invalid date + "3rd Feb".to_date => Sun, 03 Feb 2013 - *Rafael Mendonça França* + *Kelly Stannard* -* Fix `ActiveSupport::TimeZone.parse` when time is at a local DST jump. - Fixes #9678. +* It's now possible to compare `Date`, `DateTime`, `Time` and `TimeWithZone` + with `Float::INFINITY`. This allows to create date/time ranges with one infinite bound. + Example: - *Andrew White* + range = Range.new(Date.today, Float::INFINITY) + Also it's possible to check inclusion of date/time in range with conversion. -## Rails 3.2.13 (Mar 18, 2013) ## + range.include?(Time.now + 1.year) # => true + range.include?(DateTime.now + 1.year) # => true -* Fix DateTime comparison with DateTime::Infinity object. + *Alexander Grebennik* - *Dan Kubb* +* Remove meaningless `ActiveSupport::FrozenObjectError`, which was just an alias of `RuntimeError`. -* 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. + *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. + *Brett Carter* -* Fix mocha v0.13.0 compatibility. *James Mead* +* 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. -* `#as_json` isolates options when encoding a hash. [Backport #8185] - Fix #8182 + *Andrew White* +* Deprecate `Date#to_time_in_current_zone` and add `Date#in_time_zone`. *Andrew White* + +* Add `String#in_time_zone` method to convert a string to an `ActiveSupport::TimeWithZone`. *Andrew White* + +* Deprecate `ActiveSupport::BasicObject` in favor of `ActiveSupport::ProxyObject`. + This class is used for proxy classes. It avoids confusion with Ruby's `BasicObject` + class. + + *Francesco Rodriguez* + +* Patched `Marshal#load` to work with constant autoloading. Fixes autoloading + with cache stores that rely on `Marshal` (`MemCacheStore` and `FileStore`). + Fixes #8167. + + *Uriel Katz* + +* Make `Time.zone.parse` to work with JavaScript format date strings. *Andrew White* + +* 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.: + + <% cache('dashboard', expires_in: Date.current.seconds_until_end_of_day) do %> + ... + + *Olek Janiszewski* + +* No longer proxy `ActiveSupport::Multibyte#class`. *Steve Klabnik* + +* 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 } + end + Thread.new do + XmlMini.with_backend("LibXML") { libxml_power } + end + + Each thread will use it's own backend. + + *Nikita Afanasenko* + +* Dependencies no longer trigger `Kernel#autoload` in `remove_constant`. Fixes #8213. *Xavier Noria* + +* Simplify `mocha` integration and remove monkey-patches, bumping `mocha` to 0.13.0. *James Mead* + +* `#as_json` isolates options when encoding a hash. Fixes #8182. + *Yves Senn* -* Handle the possible Permission Denied errors atomic.rb might trigger due to - its chown and chmod calls. [Backport #8027] +* Deprecate `Hash#diff` in favor of minitest's #diff. *Steve Klabnik* - *Daniele Sluijters* +* `Kernel#capture` can catch output from subprocesses. *Dmitry Vorotilin* +* `to_xml` conversions now use builder's `tag!` method instead of explicit invocation of `method_missing`. -## Rails 3.2.12 (Feb 11, 2013) ## + *Nikita Afanasenko* -* No changes. +* Fixed timezone mapping of the Solomon Islands. *Steve Klabnik* +* Make callstack attribute optional in `ActiveSupport::Deprecation::Reporting` + methods `warn` and `deprecation_warning`. -## Rails 3.2.11 (Jan 8, 2012) ## + *Alexey Gaziev* -* Hash.from_xml raises when it encounters type="symbol" or type="yaml". - Use Hash.from_trusted_xml to parse this XML. +* Implement `HashWithIndifferentAccess#replace` so `key?` works correctly. *David Graham* - CVE-2013-0156 +* Handle the possible permission denied errors `atomic.rb` might trigger due to its `chown` + and `chmod` calls. - *Jeremy Kemper* + *Daniele Sluijters* +* `Hash#extract!` returns only those keys that present in the receiver. -## Rails 3.2.10 (Jan 2, 2013) ## + {a: 1, b: 2}.extract!(:a, :x) # => {:a => 1} -* No changes. + *Mikhail Dieterle* +* `Hash#extract!` returns the same subclass, that the receiver is. I.e. + `HashWithIndifferentAccess#extract!` returns a `HashWithIndifferentAccess` instance. -## Rails 3.2.9 (Nov 12, 2012) ## + *Mikhail Dieterle* -* Add logger.push_tags and .pop_tags to complement logger.tagged: +* Optimize `ActiveSupport::Cache::Entry` to reduce memory and processing overhead. *Brian Durand* +* Tests tag the Rails log with the current test class and test case: + + [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 @@ -134,141 +239,225 @@ end end *Jeremy Kemper* -* Add %:z and %::z format string support to ActiveSupport::TimeWithZone#strftime. [fixes #6962] *kennyj* +* Allow delegation to the class using the `:class` keyword, replacing + `self.class` usage: + class User + def self.hello + "world" + end -## Rails 3.2.8 (Aug 9, 2012) ## + delegate :hello, to: :class + end -* Fix ActiveSupport integration with Mocha > 0.12.1. *Mike Gunderloy* + *Marc-Andre Lafortune* -* Reverted the deprecation of ActiveSupport::JSON::Variable. *Rafael Mendonça França* +* `Date.beginning_of_week` thread local and `beginning_of_week` application + config option added (default is Monday). -* ERB::Util.html_escape now escapes single quotes. *Santiago Pastorino* + *Innokenty Mikhailov* +* An optional block can be passed to `config_accessor` to set its default value -## Rails 3.2.7 (Jul 26, 2012) ## + class User + include ActiveSupport::Configurable -* Hash#fetch(fetch) is not the same as doing hash[key] + config_accessor :hair_colors do + [:brown, :black, :blonde, :red] + end + end -* adds a missing require [fixes #6896] + User.hair_colors # => [:brown, :black, :blonde, :red] -* make sure the inflection rules are loaded when cherry-picking active_support/core_ext/string/inflections.rb [fixes #6884] + *Larry Lv* -* Merge pull request #6857 from rsutphin/as_core_ext_time_missing_require +* `ActiveSupport::Benchmarkable#silence` has been deprecated due to its lack of + thread safety. It will be removed without replacement in Rails 4.1. -* bump AS deprecation_horizon to 4.0 + *Steve Klabnik* +* 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. -## Rails 3.2.6 (Jun 12, 2012) ## + *Pranas Kiziela* -* No changes. +* `ActiveSupport::Deprecation` is now a class. It is possible to create an instance + of deprecator. Backwards compatibility has been preserved. + You can choose which instance of the deprecator will be used. -## Rails 3.2.5 (Jun 1, 2012) ## + deprecate :method_name, deprecator: deprecator_instance -* ActiveSupport::JSON::Variable is deprecated. Define your own #as_json and #encode_json methods - for custom JSON string literals. *Erich Menge* + You can use `ActiveSupport::Deprecation` in your gem. + require 'active_support/deprecation' + require 'active_support/core_ext/module/deprecation' -## Rails 3.2.4 (May 31, 2012) ## + class MyGem + def self.deprecator + ActiveSupport::Deprecation.new('2.0', 'MyGem') + end -* Added #beginning_of_hour and #end_of_hour to Time and DateTime core - extensions. *Mark J. Titorenko* + def old_method + end + def new_method + end -## Rails 3.2.3 (March 30, 2012) ## + deprecate old_method: :new_method, deprecator: deprecator + end -* No changes. + 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) + *Piotr Niełacny & Robert Pankowecki* -## Rails 3.2.2 (March 1, 2012) ## +* `ERB::Util.html_escape` encodes single quote as `#39`. Decimal form has better support in old browsers. *Kalys Osmonov* -* No changes. +* `ActiveSupport::Callbacks`: deprecate monkey patch of object callbacks. + Using the `filter` method like this: + before_filter MyFilter.new -## Rails 3.2.1 (January 26, 2012) ## + class MyFilter + def filter(controller) + end + end -* Documentation fixes and improvements. + Is now deprecated with recommendation to use the corresponding filter type + (`#before`, `#after` or `#around`): -* Update time zone offset information. *Ravil Bayramgalin* + before_filter MyFilter.new -* The deprecated `ActiveSupport::Base64.decode64` calls `::Base64.decode64` - now. *Jonathan Viney* + class MyFilter + def before(controller) + end + end -* Fixes uninitialized constant `ActiveSupport::TaggedLogging::ERROR`. *kennyj* + *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. -## Rails 3.2.0 (January 20, 2012) ## + *Leo Cassarani* -* ActiveSupport::Base64 is deprecated in favor of ::Base64. *Sergey Nartimov* +* 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. -* Module#synchronize is deprecated with no replacement. Please use `monitor` - from ruby's standard library. + *Akira Matsuda* -* (Date|DateTime|Time)#beginning_of_week accept an optional argument to - be able to set the day at which weeks are assumed to start. +* Replace deprecated `memcache-client` gem with `dalli` in `ActiveSupport::Cache::MemCacheStore`. -* Deprecated ActiveSupport::MessageEncryptor#encrypt and decrypt. *José Valim* + *Guillermo Iguaran* -* ActiveSupport::Notifications.subscribed provides subscriptions to events while a block runs. *fxn* +* Add default values to all `ActiveSupport::NumberHelper` methods, to avoid + errors with empty locales or missing values. -* Module#qualified_const_(defined?|get|set) are analogous to the corresponding methods - in the standard API, but accept qualified constant names. *fxn* + *Carlos Antonio da Silva* -* Added inflection #deconstantize which complements #demodulize. This inflection - removes the righmost segment in a qualified constant name. *fxn* +* `ActiveSupport::JSON::Variable` is deprecated. Define your own `#as_json` and + `#encode_json` methods for custom JSON string literals. -* Added ActiveSupport:TaggedLogging that can wrap any standard Logger class to provide tagging capabilities *DHH* + *Erich Menge* - Logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT)) - Logger.tagged("BCX") { Logger.info "Stuff" } # Logs "[BCX] Stuff" - Logger.tagged("BCX", "Jason") { Logger.info "Stuff" } # Logs "[BCX] [Jason] Stuff" - Logger.tagged("BCX") { Logger.tagged("Jason") { Logger.info "Stuff" } } # Logs "[BCX] [Jason] Stuff" +* Add `String#indent`. *fxn & Ace Suares* -* Added safe_constantize that constantizes a string but returns nil instead of an exception if the constant (or part of it) does not exist *Ryan Oblak* +* Inflections can now be defined per locale. `singularize` and `pluralize` + accept locale as an extra argument. -* ActiveSupport::OrderedHash is now marked as extractable when using Array#extract_options! *Prem Sichanugrist* + *David Celis* -* Added Array#prepend as an alias for Array#unshift and Array#append as an alias for Array#<< *DHH* +* `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!`. -* The definition of blank string for Ruby 1.9 has been extended to Unicode whitespace. - Also, in 1.8 the ideographic space U+3000 is considered to be whitespace. *Akira Matsuda, Damien Mathieu* + *DHH* -* The inflector understands acronyms. *dlee* +* `ERB::Util.html_escape` now escapes single quotes. *Santiago Pastorino* -* Deprecated ActiveSupport::Memoizable in favor of Ruby memoization pattern *José Valim* +* `Time#change` now works with time values with offsets other than UTC or the local time zone. *Andrew White* -* Added Time#all_day/week/quarter/year as a way of generating ranges (example: Event.where(created_at: Time.now.all_week)) *DHH* +* `ActiveSupport::Callbacks`: deprecate usage of filter object with `#before` and `#after` methods as `around` callback. *Bogdan Gusiev* -* Added instance_accessor: false as an option to Class#cattr_accessor and friends *DHH* +* Add `Time#prev_quarter` and `Time#next_quarter` short-hands for `months_ago(3)` and `months_since(3)`. *SungHee Kang* -* Removed ActiveSupport::SecureRandom in favor of SecureRandom from the standard library *Jon Leighton* +* Remove obsolete and unused `require_association` method from dependencies. *fxn* -* ActiveSupport::OrderedHash now has different behavior for #each and - \#each_pair when given a block accepting its parameters with a splat. *Andrew Radev* +* Add `:instance_accessor` option for `config_accessor`. -* ActiveSupport::BufferedLogger#silence is deprecated. If you want to squelch - logs for a certain block, change the log level for that block. + class User + include ActiveSupport::Configurable + config_accessor :allowed_access, instance_accessor: false + end -* ActiveSupport::BufferedLogger#open_log is deprecated. This method should - not have been public in the first place. + User.new.allowed_access = true # => NoMethodError + User.new.allowed_access # => NoMethodError -* ActiveSupport::BufferedLogger's behavior of automatically creating the - directory for your log file is deprecated. Please make sure to create the - directory for your log file before instantiating. + *Francesco Rodriguez* -* ActiveSupport::BufferedLogger#auto_flushing is deprecated. Either set the - sync level on the underlying file handle like this: +* `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`. - f = File.open('foo.log', 'w') - f.sync = true - ActiveSupport::BufferedLogger.new f + *Andrew Mutz* - Or tune your filesystem. The FS cache is now what controls flushing. +* Add `Hash#transform_keys`, `Hash#transform_keys!`, `Hash#deep_transform_keys`, and `Hash#deep_transform_keys!`. *Mark McSpadden* -* ActiveSupport::BufferedLogger#flush is deprecated. Set sync on your - filehandle, or tune your filesystem. +* Changed XML type `datetime` to `dateTime` (with upper case letter `T`). *Angelo Capilleri* -Please check [3-1-stable](https://github.com/rails/rails/blob/3-1-stable/activesupport/CHANGELOG.md) for previous changes. +* Add `:instance_accessor` option for `class_attribute`. *Alexey Vakhov* + +* `constantize` now looks in the ancestor chain. *Marc-Andre Lafortune & Andrew White* + +* Adds `Hash#deep_stringify_keys` and `Hash#deep_stringify_keys!` to convert all keys from a `Hash` instance into strings. *Lucas Húngaro* + +* Adds `Hash#deep_symbolize_keys` and `Hash#deep_symbolize_keys!` to convert all keys from a `Hash` instance into symbols. *Lucas Húngaro* + +* `Object#try` can't call private methods. *Vasiliy Ermolovich* + +* `AS::Callbacks#run_callbacks` remove `key` argument. *Francesco Rodriguez* + +* `deep_dup` works more expectedly now and duplicates also values in `Hash` instances and elements in `Array` instances. *Alexey Gaziev* + +* Inflector no longer applies ice -> ouse to words like "slice", "police", etc. *Wes Morgan* + +* Add `ActiveSupport::Deprecations.behavior = :silence` to completely ignore Rails runtime deprecations. *twinturbo* + +* Make `Module#delegate` stop using `send` - can no longer delegate to private methods. *dasch* + +* `ActiveSupport::Callbacks`: deprecate `:rescuable` option. *Bogdan Gusiev* + +* Adds `Integer#ordinal` to get the ordinal suffix string of an integer. *Tim Gildea* + +* `ActiveSupport::Callbacks`: `:per_key` option is no longer supported. *Bogdan Gusiev* + +* `ActiveSupport::Callbacks#define_callbacks`: add `:skip_after_callbacks_if_terminated` option. *Bogdan Gusiev* + +* Add `html_escape_once` to `ERB::Util`, and delegate the `escape_once` tag helper to it. *Carlos Antonio da Silva* + +* 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.