aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/CHANGELOG.md
Commit message (Collapse)AuthorAgeFilesLines
...
* | Deprecate implicit coercion of `ActiveSupport::Duration`Andrew White2017-03-021-0/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently `ActiveSupport::Duration` implicitly converts to a seconds value when used in a calculation except for the explicit examples of addition and subtraction where the duration is the receiver, e.g: >> 2 * 1.day => 172800 This results in lots of confusion especially when using durations with dates because adding/subtracting a value from a date treats integers as a day and not a second, e.g: >> Date.today => Wed, 01 Mar 2017 >> Date.today + 2 * 1.day => Mon, 10 Apr 2490 To fix this we're implementing `coerce` so that we can provide a deprecation warning with the intent of removing the implicit coercion in Rails 5.2, e.g: >> 2 * 1.day DEPRECATION WARNING: Implicit coercion of ActiveSupport::Duration to a Numeric is deprecated and will raise a TypeError in Rails 5.2. => 172800 In Rails 5.2 it will raise `TypeError`, e.g: >> 2 * 1.day TypeError: ActiveSupport::Duration can't be coerced into Integer This is the same behavior as with other types in Ruby, e.g: >> 2 * "foo" TypeError: String can't be coerced into Integer >> "foo" * 2 => "foofoo" As part of this deprecation add `*` and `/` methods to `AS::Duration` so that calculations that keep the duration as the receiver work correctly whether the final receiver is a `Date` or `Time`, e.g: >> Date.today => Wed, 01 Mar 2017 >> Date.today + 1.day * 2 => Fri, 03 Mar 2017 Fixes #27457.
* | Update `DateTime#change` to support usec and nsecAndrew White2017-03-021-1/+13
| | | | | | | | | | | | | | | | | | | | | | Adding support for these options now allows us to update the `DateTime#end_of` methods to match the equivalent `Time#end_of` methods, e.g: datetime = DateTime.now.end_of_day datetime.nsec == 999999999 # => true Fixes #21424.
* | Add Duration#before and #after as aliases for #ago and #sinceNick Johnstone2017-02-261-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It's common in test cases at my job to have code like this: let(:today) { customer_start_date + 2.weeks } let(:earlier_date) { today - 5.days } With this change, we can instead write let(:today) { 2.weeks.after(customer_start_date) } let(:earlier_date) { 5.days.before(today) } Closes #27721
* | AS CHANGELOG Pass [ci skip]Vipul A M2017-02-261-3/+3
| |
* | Fix typo `HashWithIndifferentAcces` to `HashWithIndifferentAccess` [ci skip]Ryuta Kamizono2017-02-251-1/+1
| |
* | Merge pull request #28157 from robin850/hwia-soft-deprecationMatthew Draper2017-02-251-0/+5
|\ \ | | | | | | | | | Soft-deprecate the `HashWithIndifferentAccess` constant
| * | Soft-deprecate the top-level HashWithIndifferentAccess classRobin Dupret2017-02-251-0/+6
| |/ | | | | | | | | | | | | Since using a `ActiveSupport::Deprecation::DeprecatedConstantProxy` would prevent people from inheriting this class and extending it from the `ActiveSupport::HashWithIndifferentAccess` one would break the ancestors chain, that's the best option we have here.
* | Merge pull request #28006 from fareastside/masterRafael Mendonça França2017-02-241-0/+6
|\ \ | | | | | | | | | Allow ActiveSupport::MarshalWithAutoloading#load to take a Proc
| * | add optional second argument to ActiveSupport core extension for ↵Jeff Latz2017-02-241-0/+6
| |/ | | | | | | Marshal#load so it can take a proc
* | Fix CHANGELOG entry position [ci skip]Rafael Mendonça França2017-02-241-2/+3
| |
* | Add missing gzip footer check in ActiveSupport::Gzip.decompressDylan Thacker-Smith2017-02-241-0/+4
|/ | | | | | | | A gzip file has a checksum and length for the decompressed data in its footer which isn't checked by just calling Zlib::GzipReader#read. Calling Zlib::GzipReader#close must be called after reading to the end of the file causes this check to be done, which is done by Zlib::GzipReader.wrap after its block is called.
* Preparing for 5.1.0.beta1 releaseRafael Mendonça França2017-02-231-0/+2
|
* Add CHANGELOG entry for #28104Andrew White2017-02-221-0/+4
|
* Revert "Merge pull request #27925 from robin850/hwia-removal"Kasper Timm Hansen2017-02-201-6/+0
| | | | | | | | | Pointed out by @matthewd that the HWIA subclass changes the AS scoped class and top-level HWIA hierarchies out from under existing classes. This reverts commit 71da39097b67114329be6d8db7fe6911124531af, reversing changes made to 41c33bd4b2ec3f4a482e6030b6fda15091d81e4a.
* Deprecate the top-level `HashWithIndifferentAccess` contantRobin Dupret2017-02-191-0/+6
| | | | | | | | | This constant was kept for the sake of backward compatibility; it is still available under `ActiveSupport::HashWithIndifferentAccess`. Furthermore, since Ruby 2.5 (https://bugs.ruby-lang.org/issues/11547) won't support top level constant lookup, people would have to update their code anyway.
* deprecate `halt_callback_chains_on_return_false` instead of ↵yuuji.yaginuma2017-02-081-1/+1
| | | | | | | | | | | | | | `halt_and_display_warning_on_return_false` `halt_and_display_warning_on_return_false` is not a public API and application is using `halt_callback_chains_on_return_false`. https://github.com/rails/rails/blob/5-0-stable/railties/lib/rails/generators/rails/app/templates/config/initializers/new_framework_defaults.rb.tt#L29 https://github.com/rails/rails/blob/5-0-stable/activesupport/lib/active_support.rb#L86..L88 Therefore, deprecate messages should be issued for `halt_callback_chains_on_return_false` instead of `halt_and_display_warning_on_return_false`.
* Deprecate halt_and_display_warning_on_return_falseRafael Mendonça França2017-02-071-0/+4
|
* Remove deprecated behavior that halts callbacks when the return is falseRafael Mendonça França2017-02-071-0/+4
|
* Deprecate passing string to `:if` and `:unless` conditional options on ↵Ryuta Kamizono2017-02-041-0/+5
| | | | `set_callback` and `skip_callback`
* Remove deprecated passing string to define callbackRyuta Kamizono2017-02-041-18/+22
| | | | And raise `ArgumentError` when passing string to define callback.
* Update Unicode Version to 9.0.0Fumiaki MATSUSHIMA2017-01-281-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | 9.0.0 was released on June 21, 2016 http://blog.unicode.org/2016/06/announcing-unicode-standard-version-90.html http://www.unicode.org/versions/Unicode9.0.0/ There are some changes about grapheme cluster in Unicode 9.0.0: http://unicode.org/reports/tr29/#Grapheme_Cluster_Boundary_Rules ------------ I noticed that `unpack_graphemes` returns [Other] when the argument is Other ÷ Prepend (it must be [Other, Prepend]). But in [Unicode 8.0.0's Prepend has no characters](http://www.unicode.org/reports/tr29/tr29-27.html#Prepend) so we don't have to backport following patch: ```diff should_break = + if pos == eoc + true ```
* CHANGELOG: Raise ArgumentError when calling transliterate on anything other ↵Kevin McPhillips2017-01-161-0/+5
| | | | than a string
* AS::StringInquirer#respond_to_missing? should fallback to superAkira Matsuda2017-01-151-2/+2
| | | | in case String or any other ancestor class' respond_to_missing? was defined.
* AS::ArrayInquirer#respond_to_missing? should fallback to superAkira Matsuda2017-01-151-0/+5
| | | | in case Array or any other ancestor class' respond_to_missing? was defined.
* Fix inconsistent results when parsing large durations and constructing ↵Andrey Novikov2017-01-091-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | durations from code ActiveSupport::Duration.parse('P3Y') == 3.years # It should be true Duration parsing made independent from any moment of time: Fixed length in seconds is assigned to each duration part during parsing. Changed duration of months and years in seconds to more accurate and logical: 1. The value of 365.2425 days in Gregorian year is more accurate as it accounts for every 400th non-leap year. 2. Month's length is bound to year's duration, which makes sensible comparisons like `12.months == 1.year` to be `true` and nonsensical ones like `30.days == 1.month` to be `false`. Calculations on times and dates with durations shouldn't be affected as duration's numeric value isn't used in calculations, only parts are used. Methods on `Numeric` like `2.days` now use these predefined durations to avoid duplicating of duration constants through the codebase and eliminate creation of intermediate durations.
* Fix Complex and Rational are duplicable?utilum2016-12-211-0/+5
| | | | See [this test](https://gist.github.com/utilum/78918f1b64f8b61ee732cb266db7c43a).
* change return value of `duplicable?` with Ruby 2.4+yuuji.yaginuma2016-12-131-0/+6
| | | | | | | `NilClass`, `FalseClass`, `TrueClass`, `Symbol` and `Numeric` can dup with Ruby 2.4+. Ref: https://bugs.ruby-lang.org/issues/12979
* remove duplicated changelog entry [ci skip]yuuji.yaginuma2016-11-151-4/+0
|
* Merge pull request #27035 from rails/remove-active-support-deprecationsAndrew White2016-11-141-0/+73
|\ | | | | Remove Active Support deprecations
| * Remove deprecated class ActiveSupport::Concurrency::LatchAndrew White2016-11-141-0/+4
| |
| * Remove deprecated separator argument from parameterizeAndrew White2016-11-141-0/+4
| |
| * Remove deprecated method Numeric#to_formatted_sAndrew White2016-11-141-0/+4
| |
| * Remove deprecated method alias_method_chainAndrew White2016-11-141-0/+4
| |
| * Remove deprecated constant MissingSourceFIleAndrew White2016-11-141-0/+4
| |
| * Remove deprecated Module.qualified_const_get/set/defined?Andrew White2016-11-141-0/+5
| |
| * Update CHANGELOGAndrew White2016-11-131-0/+48
| |
* | Revert "Merge pull request #25811 from oss92/to_sentence_fallback_string"Rafael Mendonça França2016-11-141-6/+0
|/ | | | | | | | This reverts commit bad3a120f1690f393d8f6204b3ceee60f0ce707b, reversing changes made to 2384317465ccb1dfca456a2b7798714b99f32711. Reason: Adding a new option in the API for something that can be done with a `#presence` check could do.
* Ensure duration parsing is consistent across DST changesAndrew White2016-10-311-0/+20
| | | | | | | | | | | | | | | | | | Previously `ActiveSupport::Duration.parse` used `Time.current` and `Time#advance` to calculate the number of seconds in the duration from an arbitrary collection of parts. However as `advance` tries to be consistent across DST boundaries this meant that either the duration was shorter or longer depending on the time of year. This was fixed by using an absolute reference point in UTC which isn't subject to DST transitions. An arbitrary date of Jan 1st, 2000 was chosen for no other reason that it seemed appropriate. Additionally, duration parsing should now be marginally faster as we are no longer creating instances of `ActiveSupport::TimeWithZone` every time we parse a duration string. Fixes #26941.
* Use Hash#compact and Hash#compact! from Ruby 2.4Prathamesh Sonpatki2016-10-231-2/+7
| | | | | | - Ruby 2.4 has added Hash#compact and Hash#compact! so we can use it now. - Reference: https://bugs.ruby-lang.org/issues/11818 and https://bugs.ruby-lang.org/issues/12863.
* Fix `ActiveSupport::TimeZone#strptime` cannot parse timestamps (%Q, %s)denisovlev2016-10-211-0/+7
|
* Fix copy_time_to: Copy nsec instead of usecJosua Schmid2016-10-201-0/+6
| | | | | | | | | | | | | `copy_time_to` is a helper function for date and time calculations. It's being used by `prev_week`, `next_week` and `prev_weekday` to keep the time fraction when jumping around between days. Previously the nanoseconds part was lost during the operation. This lead to problems in practice if you were using the `end_of_day` calculation. Resulting in the time fraction of `end_of_day` not being the same as next week's `end_of_day`. With this fix `copy_time_to` doesn't forget the `nsec` digits.
* Revert "Merge pull request #26677 from tbalthazar/26644"Andrew White2016-10-021-22/+0
| | | | | | | | Turns out trying to cache on localtime with arguments is too hard so we'll do it on DateAndTime::Compatibility#to_time instead. This reverts commit 9ce2d1b1a43fc4ef3db59849b7412d30583a4074, reversing changes made to 53ede1aff2025d4391d0e05ba471fdaf3110a99c.
* Fix `ActiveSupport::TimeWithZone#localtime`Thomas Balthazar2016-10-011-0/+22
| | | | | | | | | | | | | | | | | Previously memoization in `localtime` wasn't taking the `utc_offset` parameter into account when returning a cached value. It now caches the computed value depending on the `utc_offset` parameter, e.g: Time.zone = "US/Eastern" t = Time.zone.local(2016,5,2,11) # => Mon, 02 May 2016 11:00:00 EDT -04:00 t.localtime(-7200) # => 2016-05-02 13:00:00 -0200 t.localtime(-3600) # => 2016-05-02 14:00:00 -0100
* Fix ActiveSupport::TimeWithZone#inThomas Balthazar2016-09-241-0/+19
| | | | | | | | | | | | | | | Previously calls to `in` were being sent to the non-DST aware method `Time#since` via `method_missing`. It is now aliased to the DST aware `ActiveSupport::TimeWithZone#+` which handles transitions across DST boundaries, e.g: Time.zone = "US/Eastern" t = Time.zone.local(2016,11,6,1) # => Sun, 06 Nov 2016 01:00:00 EDT -05:00 t.in(1.hour) # => Sun, 06 Nov 2016 01:00:00 EST -05:00
* Merge pull request #25628 from ysksn/optionsRafael Mendonça França2016-08-171-0/+6
|\ | | | | | | Remove parameter "options = nil" for #clear
| * Update CHANGELOG.md for #25628 [ci skip]Yosuke Kabuto2016-07-021-0/+6
| | | | | | | | | | | | Move new CHANGELOG entry top [ci skip] Remove parameter "options = nil" for #clear
* | Pass over changelogs [ci skip]Vipul A M2016-08-101-3/+3
| |
* | Merge pull request #25681 from willnet/fix-thread_mattr_accessorYves Senn2016-08-081-0/+28
|\ \ | | | | | | | | | Fix `thread_mattr_accessor` share variable superclass with subclass
| * | Fix `thread_mattr_accessor` share variable superclass with subclasswillnet2016-08-041-0/+7
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The current implementation of `thread_mattr_accessor` set variable sharing superclass with subclass. So the method doesn't work as documented. Precondition class Account thread_mattr_accessor :user end class Customer < Account end Account.user = "DHH" Account.user #=> "DHH" Customer.user = "Rafael" Customer.user # => "Rafael" Documented behavior Account.user # => "DHH" Actual behavior Account.user # => "Rafael" Current implementation set variable statically likes `Thread[:attr_Account_user]`, and customer also use it. Make variable name dynamic to use own thread-local variable.
* | Add :weeks to the list of variable duration partsAndrew White2016-08-031-0/+8
| | | | | | | | | | | | | | | | Since 434df00 week durations are no longer converted to days. This means we need to add :weeks to the parts that ActiveSupport::TimeWithZone will consider being of variable duration to take account of DST transitions. Fixes #26039.