aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/CHANGELOG.md
Commit message (Collapse)AuthorAgeFilesLines
...
| * | Remove implicit coercion deprecation of durationsAndrew White2017-03-151-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In #28204 we deprecated implicit conversion of durations to a numeric which represented the number of seconds in the duration because of unwanted side effects with calculations on durations and dates. This unfortunately had the side effect of forcing a explicit cast when configuring third-party libraries like expiration in Redis, e.g: redis.expire("foo", 5.minutes) To work around this we've removed the deprecation and added a private class that wraps the numeric and can perform calculation involving durations and ensure that they remain a duration irrespective of the order of operations.
| * | Lint activesupport/CHANGELOG.mdJon Moss2017-03-131-8/+10
| | | | | | | | | | | | [ci skip]
| * | Fix indentation and formatting in CHANGELOGs [ci skip]Ryuta Kamizono2017-03-111-17/+17
| | |
| * | Fix typo `titlelize` -> `titleize` [ci skip]yuuji.yaginuma2017-03-071-2/+2
| | |
| * | Update `titlelize` regex to allow apostrophesAndrew White2017-03-061-0/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In 4b685aa the regex in `titlelize` was updated to not match apostrophes to better reflect the nature of the transformation. Unfortunately this had the side effect of breaking capitalization on the first word of a sub-string, e.g: >> "This was 'fake news'".titleize => "This Was 'fake News'" This is fixed by extending the look-behind to also check for a word character on the other side of the apostrophe. Fixes #28312.
* | | Add CHANGELOG entry [skip ci]Erol Fornoles2017-03-061-0/+4
|/ /
* | Add `rfc3339` aliases to `xmlschema`Andrew White2017-03-031-0/+6
| | | | | | | | | | For naming consistency when using the RFC 3339 profile of ISO 8601 in applications.
* | Add `Time.rfc3339` parsing methodAndrew White2017-03-031-0/+8
| | | | | | | | | | | | | | The `Time.xmlschema` and consequently its alias `iso8601` accepts timestamps without a offset in contravention of the RFC 3339 standard. This method enforces that constraint and raises an `ArgumentError` if it doesn't.
* | Add `ActiveSupport::TimeZone.rfc3339` parsing methodAndrew White2017-03-031-0/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously there was no way to get a RFC 3339 timestamp into a specific timezone without either using `parse` or chaining methods. The new method allows parsing directly into the timezone, e.g: >> Time.zone = "Hawaii" => "Hawaii" >> Time.zone.rfc3339("1999-12-31T14:00:00Z") => Fri, 31 Dec 1999 14:00:00 HST -10:00 This new method has stricter semantics than the current `parse` method and will raise an `ArgumentError` instead of returning nil, e.g: >> Time.zone = "Hawaii" => "Hawaii" >> Time.zone.rfc3339("foobar") ArgumentError: invalid date >> Time.zone.parse("foobar") => nil It will also raise an `ArgumentError` when either the time or offset components are missing, e.g: >> Time.zone = "Hawaii" => "Hawaii" >> Time.zone.rfc3339("1999-12-31") ArgumentError: invalid date >> Time.zone.rfc3339("1999-12-31T14:00:00") ArgumentError: invalid date
* | Add `ActiveSupport::TimeZone.iso8601` parsing methodAndrew White2017-03-031-0/+31
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously there was no way to get a ISO 8601 timestamp into a specific timezone without either using `parse` or chaining methods. The new method allows parsing directly into the timezone, e.g: >> Time.zone = "Hawaii" => "Hawaii" >> Time.zone.iso8601("1999-12-31T14:00:00Z") => Fri, 31 Dec 1999 14:00:00 HST -10:00 If the timestamp is a ISO 8601 date (YYYY-MM-DD) then the time is set to midnight, e.g: >> Time.zone = "Hawaii" => "Hawaii" >> Time.zone.iso8601("1999-12-31") => Fri, 31 Dec 1999 00:00:00 HST -10:00 This new method has stricter semantics than the current `parse` method and will raise an `ArgumentError` instead of returning nil, e.g: >> Time.zone = "Hawaii" => "Hawaii" >> Time.zone.iso8601("foobar") ArgumentError: invalid date >> Time.zone.parse("foobar") => nil
* | 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
|