diff options
Diffstat (limited to 'activesupport/CHANGELOG.md')
-rw-r--r-- | activesupport/CHANGELOG.md | 624 |
1 files changed, 312 insertions, 312 deletions
diff --git a/activesupport/CHANGELOG.md b/activesupport/CHANGELOG.md index a4c6ea4236..19db8ac873 100644 --- a/activesupport/CHANGELOG.md +++ b/activesupport/CHANGELOG.md @@ -1,501 +1,501 @@ -## Rails 4.0.0 (unreleased) ## +* Don't lazy load the `tzinfo` library as it causes problems on Windows. -* `Class#class_attribute` accepts an `instance_predicate` option which - defaults to `true`. If set to `false` the predicate method will not - be defined. + Fixes #13553 - *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* + *Andrew White* +* Use `remove_possible_method` instead of `remove_method` to avoid + a `NameError` to be thrown on FreeBSD with the `Date` object. -## Rails 4.0.0.beta1 (February 25, 2013) ## + *Rafael Mendonça França*, *Robin Dupret* -* Improve singularizing a singular for multiple cases. - Fixes #2608 #1825 #2395. +* `blank?` and `present?` commit to return singletons. - Example: + *Xavier Noria*, *Pavel Pravosud* - # Before - 'address'.singularize # => 'addres' +* Fixed Float related error in NumberHelper with large precisions. - # After - 'address'.singularize # => 'address' + before: + ActiveSupport::NumberHelper.number_to_rounded '3.14159', precision: 50 + #=> "3.14158999999999988261834005243144929409027099609375" + after: + ActiveSupport::NumberHelper.number_to_rounded '3.14159', precision: 50 + #=> "3.14159000000000000000000000000000000000000000000000" - *Mark McSpadden* + *Kenta Murata*, *Akira Matsuda* -* Prevent `DateTime#change` from truncating the second fraction, when seconds - do not need to be changed. +* 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. - *Chris Baynes* + To disable it add the following configuration to your application: -* Added `ActiveSupport::TimeWithZone#to_r` for `Time#at` compatibility. + config.i18n.enforce_available_locales = false - Before this change: + This also ensures I18n configuration is properly initialized taking the new + option into account, to avoid their deprecations while booting up the app. - Time.zone = 'Tokyo' - time = Time.zone.now - time == Time.at(time) # => false + *Carlos Antonio da Silva*, *Yves Senn* - After the change: +* Introduce Module#concerning: a natural, low-ceremony way to separate + responsibilities within a class. - Time.zone = 'Tokyo' - time = Time.zone.now - time == Time.at(time) # => true + Imported from https://github.com/37signals/concerning#readme - *stopdropandrew* + class Todo < ActiveRecord::Base + concerning :EventTracking do + included do + has_many :events + end -* `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. + def latest_event + ... + end - Examples: + private + def some_internal_method + ... + end + end - number_to_human(123, units: {}) # => 123 - number_to_human(123, units: { thousand: 'k' }) # => 123 + concerning :Trashable do + def trashed? + ... + end - *Michael Hoffman* + def latest_event + super some_option: true + end + end + end -* Added `beginning_of_minute` support to core ext calculations for `Time` and `DateTime`. + is equivalent to defining these modules inline, extending them into + concerns, then mixing them in to the class. - *Gagan Awhad* + 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. -* Add `:nsec` date format. + 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. - *Jamie Gaskins* + *Jeremy Kemper* -* `ActiveSupport::Gzip.compress` allows two optional arguments for compression - level and strategy. +* Fix file descriptor being leaked on each call to `Kernel.silence_stream`. - *Beyond* + *Mario Visic* -* 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. +* Added `Date#all_week/month/quarter/year` for generating date ranges. - *James Harton* + *Dmitriy Meremyanin* -* Improve `String#squish` to handle Unicode whitespace. *Antoine Lyset* +* 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`. -* Standardize on `to_time` returning an instance of `Time` in the local system timezone - across `String`, `Time`, `Date`, `DateTime` and `ActiveSupport::TimeWithZone`. + *Colin Bartlett* - *Andrew White* +* Show valid keys when `assert_valid_keys` raises an exception, and show the + wrong value as it was entered. -* Extract `ActiveSupport::Testing::Performance` into https://github.com/rails/rails-perftest - You can add the gem to your `Gemfile` to keep using performance tests. + *Gonzalo Rodríguez-Baltanás Díaz* - gem 'rails-perftest' +* Both `cattr_*` and `mattr_*` method definitions now live in `active_support/core_ext/module/attribute_accessors`. - *Yves Senn* - -* `Hash.from_xml` raises when it encounters `type="symbol"` or `type="yaml"`. - Use `Hash.from_trusted_xml` to parse this XML. + Requires to `active_support/core_ext/class/attribute_accessors` are + deprecated and will be removed in Ruby on Rails 4.2. - CVE-2013-0156 + *Genadi Samokovarov* - *Jeremy Kemper* +* 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` -* Deprecate `assert_present` and `assert_blank` in favor of - `assert object.blank?` and `assert object.present?` + This will help to catch subtle bugs like: - *Yves Senn* + def recent?(days = 3) + self.created_at >= days.ago + end -* Change `String#to_date` to use `Date.parse`. This gives more consistent error - messages and allows the use of partial dates. + The above code would check if the model is created within the last 3 **seconds**. - "gibberish".to_date => Argument Error: invalid date - "3rd Feb".to_date => Sun, 03 Feb 2013 + 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. - *Kelly Stannard* + *Godfrey Chan* -* 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: +* Requires JSON gem version 1.7.7 or above due to a security issue in older versions. - range = Range.new(Date.today, Float::INFINITY) + *Godfrey Chan* - Also it's possible to check inclusion of date/time in range with conversion. +* Removed the old pure-Ruby JSON encoder and switched to a new encoder based on the built-in JSON + gem. - range.include?(Time.now + 1.year) # => true - range.include?(DateTime.now + 1.year) # => true + 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. - *Alexander Grebennik* + 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. -* Remove meaningless `ActiveSupport::FrozenObjectError`, which was just an alias of `RuntimeError`. + Setting the related configuration `ActiveSupport.encode_big_decimal_as_string` without the + `activesupport-json_encoder` gem installed will raise an error. - *Akira Matsuda* + *Godfrey Chan* -* Introduce `assert_not` to replace warty `assert !foo`. *Jeremy Kemper* +* 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. -* Prevent `Callbacks#set_callback` from setting the same callback twice. + Example for `#travel`: - before_save :foo, :bar, :foo + 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 - will at first call `bar`, then `foo`. `foo` will no more be called - twice. + Example for `#travel_to`: - *Dmitriy Kiriyenko* + 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 -* Add `ActiveSupport::Logger#silence` that works the same as the old `Logger#silence` extension. + 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: - *DHH* + Time.now # => 2013-11-09 15:34:49 -05:00 -* 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* + travel 1.day do + User.create.created_at # => Sun, 10 Nov 2013 15:34:49 EST -05:00 + end -* 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. + 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 -* Deprecate `Date#to_time_in_current_zone` and add `Date#in_time_zone`. *Andrew White* + This module is included in `ActiveSupport::TestCase` automatically. -* Add `String#in_time_zone` method to convert a string to an `ActiveSupport::TimeWithZone`. *Andrew White* + *Prem Sichanugrist*, *DHH* -* Deprecate `ActiveSupport::BasicObject` in favor of `ActiveSupport::ProxyObject`. - This class is used for proxy classes. It avoids confusion with Ruby's `BasicObject` - class. +* Unify `cattr_*` interface: allow to pass a block to `cattr_reader`. - *Francesco Rodriguez* + Example: -* Patched `Marshal#load` to work with constant autoloading. Fixes autoloading - with cache stores that rely on `Marshal` (`MemCacheStore` and `FileStore`). - Fixes #8167. + class A + cattr_reader(:defr) { 'default_reader_value' } + end + A.defr # => 'default_reader_value' - *Uriel Katz* + *Alexey Chernenkov* -* Make `Time.zone.parse` to work with JavaScript format date strings. *Andrew White* +* Improved compatibility with the stdlib JSON gem. -* 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.: + Previously, calling `::JSON.{generate,dump}` sometimes causes unexpected + failures such as intridea/multi_json#86. - <% cache('dashboard', expires_in: Date.current.seconds_until_end_of_day) do %> - ... + `::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)`. - *Olek Janiszewski* + *Godfrey Chan* -* No longer proxy `ActiveSupport::Multibyte#class`. *Steve Klabnik* +* Fix Active Support `Time#to_json` and `DateTime#to_json` to return 3 decimal + places worth of fractional seconds, similar to `TimeWithZone`. -* Deprecate `ActiveSupport::TestCase#pending` method, use `skip` from minitest instead. *Carlos Antonio da Silva* + *Ryan Glover* -* `XmlMini.with_backend` now may be safely used with threads: +* Removed circular reference protection in JSON encoder, deprecated + `ActiveSupport::JSON::Encoding::CircularReferenceError`. - Thread.new do - XmlMini.with_backend("REXML") { rexml_power } - end - Thread.new do - XmlMini.with_backend("LibXML") { libxml_power } - end + *Godfrey Chan*, *Sergio Campamá* - Each thread will use it's own backend. +* Add `capitalize` option to `Inflector.humanize`, so strings can be humanized without being capitalized: - *Nikita Afanasenko* + 'employee_salary'.humanize # => "Employee salary" + 'employee_salary'.humanize(capitalize: false) # => "employee salary" -* Dependencies no longer trigger `Kernel#autoload` in `remove_constant`. Fixes #8213. *Xavier Noria* + *claudiob* -* Simplify `mocha` integration and remove monkey-patches, bumping `mocha` to 0.13.0. *James Mead* +* Fixed `Object#as_json` and `Struct#as_json` not working properly with options. They now take + the same options as `Hash#as_json`: -* `#as_json` isolates options when encoding a hash. Fixes #8182. + struct = Struct.new(:foo, :bar).new + struct.foo = "hello" + struct.bar = "world" + json = struct.as_json(only: [:foo]) # => {foo: "hello"} - *Yves Senn* + *Sergio Campamá*, *Godfrey Chan* -* Deprecate `Hash#diff` in favor of minitest's #diff. *Steve Klabnik* +* Added `Numeric#in_milliseconds`, like `1.hour.in_milliseconds`, so we can feed them to JavaScript functions like `getTime()`. -* `Kernel#capture` can catch output from subprocesses. *Dmitry Vorotilin* + *DHH* -* `to_xml` conversions now use builder's `tag!` method instead of explicit invocation of `method_missing`. +* Calling `ActiveSupport::JSON.decode` with unsupported options now raises an error. - *Nikita Afanasenko* + *Godfrey Chan* -* Fixed timezone mapping of the Solomon Islands. *Steve Klabnik* +* Support `:unless_exist` in `FileStore`. -* Make callstack attribute optional in `ActiveSupport::Deprecation::Reporting` - methods `warn` and `deprecation_warning`. + *Michael Grosser* - *Alexey Gaziev* +* Fix `slice!` deleting the default value of the hash. -* Implement `HashWithIndifferentAccess#replace` so `key?` works correctly. *David Graham* + *Antonio Santos* -* Handle the possible permission denied errors `atomic.rb` might trigger due to its `chown` - and `chmod` calls. +* `require_dependency` accepts objects that respond to `to_path`, in + particular `Pathname` instances. - *Daniele Sluijters* + *Benjamin Fleischer* -* `Hash#extract!` returns only those keys that present in the receiver. +* Disable the ability to iterate over Range of AS::TimeWithZone + due to significant performance issues. - {a: 1, b: 2}.extract!(:a, :x) # => {:a => 1} + *Bogdan Gusiev* - *Mikhail Dieterle* +* Allow attaching event subscribers to ActiveSupport::Notifications namespaces + before they're defined. Essentially, this means instead of this: -* `Hash#extract!` returns the same subclass, that the receiver is. I.e. - `HashWithIndifferentAccess#extract!` returns a `HashWithIndifferentAccess` instance. + class JokeSubscriber < ActiveSupport::Subscriber + def sql(event) + puts "A rabbi and a priest walk into a bar..." + end - *Mikhail Dieterle* + # This call needs to happen *after* defining the methods. + attach_to "active_record" + end -* Optimize `ActiveSupport::Cache::Entry` to reduce memory and processing overhead. *Brian Durand* + You can do this: -* Tests tag the Rails log with the current test class and test case: + class JokeSubscriber < ActiveSupport::Subscriber + # This is much easier to read! + attach_to "active_record" - [SessionsControllerTest] [test_0002_sign in] Processing by SessionsController#create as HTML - [SessionsControllerTest] [test_0002_sign in] ... + def sql(event) + puts "A rabbi and a priest walk into a bar..." + end + end - *Jeremy Kemper* + This should make it easier to read and understand these subscribers. -* Add `logger.push_tags` and `.pop_tags` to complement `logger.tagged`: + *Daniel Schierbeck* - class Job - def before - Rails.logger.push_tags :jobs, self.class.name - end +* Add `Date#middle_of_day`, `DateTime#middle_of_day` and `Time#middle_of_day` methods. - def after - Rails.logger.pop_tags 2 - end - end + Also added `midday`, `noon`, `at_midday`, `at_noon` and `at_middle_of_day` as aliases. - *Jeremy Kemper* + *Anatoli Makarevich* -* Allow delegation to the class using the `:class` keyword, replacing - `self.class` usage: +* Fix ActiveSupport::Cache::FileStore#cleanup to no longer rely on missing each_key method. - class User - def self.hello - "world" - end + *Murray Steele* - delegate :hello, to: :class - end +* Ensure that autoloaded constants in all-caps nestings are marked as + autoloaded. - *Marc-Andre Lafortune* + *Simon Coffey* -* `Date.beginning_of_week` thread local and `beginning_of_week` application - config option added (default is Monday). +* Add `String#remove(pattern)` as a short-hand for the common pattern of + `String#gsub(pattern, '')`. - *Innokenty Mikhailov* + *DHH* -* An optional block can be passed to `config_accessor` to set its default value +* Adds a new deprecation behaviour that raises an exception. Throwing this + line into +config/environments/development.rb+ - class User - include ActiveSupport::Configurable + ActiveSupport::Deprecation.behavior = :raise - config_accessor :hair_colors do - [:brown, :black, :blonde, :red] - end - end + will cause the application to raise an +ActiveSupport::DeprecationException+ + on deprecations. - User.hair_colors # => [:brown, :black, :blonde, :red] + Use this for aggressive deprecation cleanups. - *Larry Lv* + *Xavier Noria* -* `ActiveSupport::Benchmarkable#silence` has been deprecated due to its lack of - thread safety. It will be removed without replacement in Rails 4.1. +* Remove 'cow' => 'kine' irregular inflection from default inflections. - *Steve Klabnik* + *Andrew White* -* 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. +* Add `DateTime#to_s(:iso8601)` and `Date#to_s(:iso8601)` for consistency. - *Pranas Kiziela* + *Andrew White* -* `ActiveSupport::Deprecation` is now a class. It is possible to create an instance - of deprecator. Backwards compatibility has been preserved. +* Add `Time#to_s(:iso8601)` for easy conversion of times to the iso8601 format for easy Javascript date parsing. - You can choose which instance of the deprecator will be used. + *DHH* - deprecate :method_name, deprecator: deprecator_instance +* Improve `ActiveSupport::Cache::MemoryStore` cache size calculation. + The memory used by a key/entry pair is calculated via `#cached_size`: - You can use `ActiveSupport::Deprecation` in your gem. + def cached_size(key, entry) + key.to_s.bytesize + entry.size + PER_ENTRY_OVERHEAD + end - require 'active_support/deprecation' - require 'active_support/core_ext/module/deprecation' + 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 - class MyGem - def self.deprecator - ActiveSupport::Deprecation.new('2.0', 'MyGem') - end + *Simeon Simeonov* - def old_method - end +* Only raise `Module::DelegationError` if it's the source of the exception. - def new_method - end + Fixes #10559 - deprecate old_method: :new_method, deprecator: deprecator - end + *Andrew White* - 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) +* Make `Time.at_with_coercion` retain the second fraction and return local time. - *Piotr Niełacny & Robert Pankowecki* + Fixes #11350 -* `ERB::Util.html_escape` encodes single quote as `#39`. Decimal form has better support in old browsers. *Kalys Osmonov* + *Neer Friedman*, *Andrew White* -* `ActiveSupport::Callbacks`: deprecate monkey patch of object callbacks. - Using the `filter` method like this: +* Make `HashWithIndifferentAccess#select` always return the hash, even when + `Hash#select!` returns `nil`, to allow further chaining. - before_filter MyFilter.new + *Marc Schütz* - class MyFilter - def filter(controller) - end - end +* Remove deprecated `String#encoding_aware?` core extensions (`core_ext/string/encoding`). - Is now deprecated with recommendation to use the corresponding filter type - (`#before`, `#after` or `#around`): + *Arun Agrawal* - before_filter MyFilter.new +* Remove deprecated `Module#local_constant_names` in favor of `Module#local_constants`. - class MyFilter - def before(controller) - end - end + *Arun Agrawal* - *Bogdan Gusiev* +* Remove deprecated `DateTime.local_offset` in favor of `DateTime.civil_from_format`. -* 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 behavior of the corresponding methods on the `Hash` class. + *Arun Agrawal* - *Leo Cassarani* +* Remove deprecated `Logger` core extensions (`core_ext/logger.rb`). -* 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. + *Carlos Antonio da Silva* - *Akira Matsuda* +* Remove deprecated `Time#time_with_datetime_fallback`, `Time#utc_time` + and `Time#local_time` in favor of `Time#utc` and `Time#local`. -* Replace deprecated `memcache-client` gem with `dalli` in `ActiveSupport::Cache::MemCacheStore`. + *Vipul A M* - *Guillermo Iguaran* +* Remove deprecated `Hash#diff` with no replacement. -* Add default values to all `ActiveSupport::NumberHelper` methods, to avoid - errors with empty locales or missing values. + If you're using it to compare hashes for the purpose of testing, please use + MiniTest's `assert_equal` instead. *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 `Date#to_time_in_current_zone` in favor of `Date#in_time_zone`. - *Erich Menge* + *Vipul A M* -* Add `String#indent`. *fxn & Ace Suares* +* Remove deprecated `Proc#bind` with no replacement. -* Inflections can now be defined per locale. `singularize` and `pluralize` - accept locale as an extra argument. + *Carlos Antonio da Silva* - *David Celis* +* Remove deprecated `Array#uniq_by` and `Array#uniq_by!`, use native + `Array#uniq` and `Array#uniq!` instead. -* `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!`. + *Carlos Antonio da Silva* - *DHH* +* Remove deprecated `ActiveSupport::BasicObject`, use `ActiveSupport::ProxyObject` instead. -* `ERB::Util.html_escape` now escapes single quotes. *Santiago Pastorino* + *Carlos Antonio da Silva* -* `Time#change` now works with time values with offsets other than UTC or the local time zone. *Andrew White* +* Remove deprecated `BufferedLogger`, use `ActiveSupport::Logger` instead. -* `ActiveSupport::Callbacks`: deprecate usage of filter object with `#before` and `#after` methods as `around` callback. *Bogdan Gusiev* + *Yves Senn* -* Add `Time#prev_quarter` and `Time#next_quarter` short-hands for `months_ago(3)` and `months_since(3)`. *SungHee Kang* +* Remove deprecated `assert_present` and `assert_blank` methods, use `assert + object.blank?` and `assert object.present?` instead. -* Remove obsolete and unused `require_association` method from dependencies. *fxn* + *Yves Senn* -* Add `:instance_accessor` option for `config_accessor`. +* Fix return value from `BacktraceCleaner#noise` when the cleaner is configured + with multiple silencers. - class User - include ActiveSupport::Configurable - config_accessor :allowed_access, instance_accessor: false - end + Fixes #11030 - User.new.allowed_access = true # => NoMethodError - User.new.allowed_access # => NoMethodError + *Mark J. Titorenko* - *Francesco Rodriguez* +* `HashWithIndifferentAccess#select` now returns a `HashWithIndifferentAccess` + instance instead of a `Hash` instance. -* `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`. + Fixes #10723 - *Andrew Mutz* + *Albert Llop* -* Add `Hash#transform_keys`, `Hash#transform_keys!`, `Hash#deep_transform_keys`, and `Hash#deep_transform_keys!`. *Mark McSpadden* +* Add `DateTime#usec` and `DateTime#nsec` so that `ActiveSupport::TimeWithZone` keeps + sub-second resolution when wrapping a `DateTime` value. -* Changed XML type `datetime` to `dateTime` (with upper case letter `T`). *Angelo Capilleri* + Fixes #10855 -* Add `:instance_accessor` option for `class_attribute`. *Alexey Vakhov* + *Andrew White* -* `constantize` now looks in the ancestor chain. *Marc-Andre Lafortune & Andrew White* +* Fix `ActiveSupport::Dependencies::Loadable#load_dependency` calling + `#blame_file!` on Exceptions that do not have the Blamable mixin -* Adds `Hash#deep_stringify_keys` and `Hash#deep_stringify_keys!` to convert all keys from a `Hash` instance into strings. *Lucas Húngaro* + *Andrew Kreiling* -* Adds `Hash#deep_symbolize_keys` and `Hash#deep_symbolize_keys!` to convert all keys from a `Hash` instance into symbols. *Lucas Húngaro* +* Override `Time.at` to support the passing of Time-like values when called with a single argument. -* `Object#try` can't call private methods. *Vasiliy Ermolovich* + *Andrew White* -* `AS::Callbacks#run_callbacks` remove `key` argument. *Francesco Rodriguez* +* Prevent side effects to hashes inside arrays when + `Hash#with_indifferent_access` is called. -* `deep_dup` works more expectedly now and duplicates also values in `Hash` instances and elements in `Array` instances. *Alexey Gaziev* + Fixes #10526 -* Inflector no longer applies ice -> ouse to words like "slice", "police", etc. *Wes Morgan* + *Yves Senn* -* Add `ActiveSupport::Deprecations.behavior = :silence` to completely ignore Rails runtime deprecations. *twinturbo* +* Removed deprecated `ActiveSupport::JSON::Variable` with no replacement. -* Make `Module#delegate` stop using `send` - can no longer delegate to private methods. *dasch* + *Toshinori Kajihara* -* `ActiveSupport::Callbacks`: deprecate `:rescuable` option. *Bogdan Gusiev* +* 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 `Integer#ordinal` to get the ordinal suffix string of an integer. *Tim Gildea* + *Mike Dillon* -* `ActiveSupport::Callbacks`: `:per_key` option is no longer supported. *Bogdan Gusiev* +* Replace `multi_json` with `json`. -* `ActiveSupport::Callbacks#define_callbacks`: add `:skip_after_callbacks_if_terminated` option. *Bogdan Gusiev* + Since Rails requires Ruby 1.9 and since Ruby 1.9 includes `json` in the standard library, + `multi_json` is no longer necessary. -* Add `html_escape_once` to `ERB::Util`, and delegate the `escape_once` tag helper to it. *Carlos Antonio da Silva* + *Erik Michaels-Ober* -* Deprecates the compatibility method `Module#local_constant_names`, - use `Module#local_constants` instead (which returns symbols). *Xavier Noria* +* 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. -* Deletes the compatibility method `Module#method_names`, - use `Module#methods` from now on (which returns symbols). *Xavier Noria* + *Mario Caropreso + Viktor Kelemen + zackham* -* Deletes the compatibility method `Module#instance_method_names`, - use `Module#instance_methods` from now on (which returns symbols). *Xavier Noria* +* Fix skipping object callbacks using metadata fetched via callback chain + inspection methods (`_*_callbacks`) -* `BufferedLogger` is deprecated. Use `ActiveSupport::Logger`, or the logger - from the Ruby standard library. + *Sean Walbran* - *Aaron Patterson* +* Add a `fetch_multi` method to the cache stores. The method provides + an easy to use API for fetching multiple values from the cache. -* Unicode database updated to 6.1.0. *Norman Clarke* + Example: -* Adds `encode_big_decimal_as_string` option to force JSON serialization of `BigDecimal` as numeric instead - of wrapping them in strings for safety. + # 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 -* Optimize log subscribers to check log level before doing any processing. *Brian Durand* + *Daniel Schierbeck* -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. |