aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
Commit message (Collapse)AuthorAgeFilesLines
* Test that cache stores build unversioned keysGeorge Claghorn2017-12-221-0/+12
|
* Revert "Remove code duplication in ActiveSupport::Cache"George Claghorn2017-12-221-11/+26
| | | | This reverts commit 57f0e3d1300d01444d2a311560c055d26968dc3f.
* Handle `FrozenError` if it is availableYasuo Honda2017-12-202-1/+5
| | | | | | | | | | | | | | | This pull request handles `FrozenError` introduced by Ruby 2.5. Refer https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/61131 Since `FrozenError` is a subclass of `RuntimeError` minitest used by master branch can handle it, though it would be better to handle `FrozenError` explicitly if possible. `FrozenError` does not exist in Ruby 2.4 or lower, `frozen_error_class` handles which exception is expected to be raised. This pull request is intended to be merged to master, then backported to `5-1-stable` to address #31508
* Merge pull request #31348 from y-yagi/fix_31283Kasper Timm Hansen2017-12-184-11/+23
|\ | | | | Raise an error only when `require_master_key` is specified
| * Raise an error only when `require_master_key` is specifiedyuuji.yaginuma2017-12-184-11/+23
| | | | | | | | | | | | | | | | | | To prevent errors from being raise in environments where credentials is unnecessary. Context: https://github.com/rails/rails/issues/31283#issuecomment-348801489 Fixes #31283
* | Merge pull request #31479 from iamvery/reword-delegate-allow-nil-paragraphEileen M. Uchitelle2017-12-181-5/+2
|\ \ | | | | | | Clarify docs for delegate :allow_nil option
| * | Clarify docs for delegate :allow_nil optionJay Hayes2017-12-151-5/+2
| |/
* / Don't include ellipsis in truncated digest outputEugene Kenny2017-12-174-15/+7
|/ | | | | | | | | | Using `truncate` to limit the length of the digest has the unwanted side effect of adding an ellipsis when the input is longer than the limit. Also: - Don't instantiate a new object for every digest - Rename the configuration option to `hash_digest_class` - Update the CHANGELOG entry to describe how to use the feature
* Suppress `warning: BigDecimal.new is deprecated`Yasuo Honda2017-12-156-12/+12
| | | | | | | | | | | | | | | | | | | | `BigDecimal.new` has been deprecated in BigDecimal 1.3.3 which will be a default for Ruby 2.5. Refer https://github.com/ruby/bigdecimal/commit/533737338db915b00dc7168c3602e4b462b23503 * This commit has been made as follows: ``` cd rails git grep -l BigDecimal.new | grep -v guides/source/5_0_release_notes.md | grep -v activesupport/test/xml_mini_test.rb | xargs sed -i -e "s/BigDecimal.new/BigDecimal/g" ``` - `activesupport/test/xml_mini_test.rb` Editmanually to remove `.new` and `::` - guides/source/5_0_release_notes.md This is a Rails 5.0 release notes.
* RedisCacheStore - Fix Default Error HandlerJesse Doyle2017-12-141-3/+5
| | | | | | | | | * The `DEFAULT_ERROR_HANDLER` constant in `ActiveSupport::Cache::RedisCacheStore` contained references to an undefined argument `e`, which is supposed to refer to the `exception` parameter. * Update the default error handler proc to correctly reference the `exception` parameter.
* Address `warning: instance variable @hash_digest_class not initialized`Yasuo Honda2017-12-141-1/+1
| | | | | | | ```ruby /path/to/rails/activesupport/lib/active_support/digest.rb:7: warning: instance variable @hash_digest_class not initialized ``
* Merge pull request #31289 from witlessbird/fips-compatibilityEileen M. Uchitelle2017-12-147-3/+72
|\ | | | | Initial support for running Rails on FIPS-certified systems
| * Introduced `ActiveSupport::Digest` that allows to specify hash function ↵Dmitri Dolguikh2017-12-127-3/+72
| | | | | | | | | | | | | | | | implementation and defaults to `Digest::MD5`. Replaced calls to `::Digest::MD5.hexdigest` with calls to `ActiveSupport::Digest.hexdigest`.
* | Enable `Layout/LeadingCommentSpace` to not allow cosmetic changes in the futureRyuta Kamizono2017-12-1411-47/+47
| | | | | | | | Follow up of #31432.
* | Preserve original method visibility when deprecating a methodJordan Brough2017-12-132-0/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit fixes `deprecate` so that it preserves method visibility (like it did previously when it was utilizing `alias_method_chain`). When Module#prepend replaced alias_method_chain in a982a42 it caused deprecated methods to always become public. `alias_method_chain` had this bit of code: https://github.com/rails/rails/blob/v5.0.6/activesupport/lib/active_support/core_ext/module/aliasing.rb#L40-L47 which preserved method visibility. Without this fix, a workaround would be: ```ruby class C8 private def new_method end def old_method end deprecate :old_method, :new_method # workaround: instance_method(:old_method).owner.send(:private, :old_method) end ``` Because the visibility needs to be fixed on the Module prepended by MethodWrapper.
* | [ci skip] Fix Active Support Changelog about :race_condition_ttlMehmet Emin INAC2017-12-121-1/+1
| |
* | Enable `Layout/SpaceBeforeComma` rubocop rule, and fixed moreRyuta Kamizono2017-12-127-18/+18
| | | | | | | | Follow up of #31390.
* | Prevent race condition when resetting time stubsEugene Kenny2017-12-121-1/+2
| | | | | | | | | | | | | | | | | | If the current thread is preempted after the stub has been removed but before the original method has been restored, then the other thread will get a `NoMethodError` when it tries to call the method. Using `silence_redefinition_of_method` instead of `undef_method` ensures that either the stub or the original method is always in place.
* | [ci skip] Make Todo classes inherit ApplicationRecordYoshiyuki Hirano2017-12-071-5/+5
|/ | | | | Example codes that use `has_many` or `before_create` in `Module::Concerning` look like active record models. So I've made them inherit `ApplicationRecord`.
* Mention about Ruby 2.4 Unicode case mappings in `mb_chars` example [ci skip] ↵Ryuta Kamizono2017-11-291-1/+3
| | | | | (#31275) https://www.ruby-lang.org/en/news/2016/09/08/ruby-2-4-0-preview2-released/
* [ci skip] Correct output for UpcaseDixit Patel2017-11-291-1/+1
|
* Merge pull request #31268 from tjschuck/refactor_prev_next_occurringRafael França2017-11-283-26/+32
|\ | | | | Refactor Date/Time next_occurring and prev_occurring
| * Refactor Date/Time next_occurring and prev_occurringT.J. Schuck2017-11-283-26/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These methods were originally added in https://github.com/rails/rails/pull/26600 This includes a couple of refactors to make these methods behave more similarly to other Date/Time extensions added by Active Support: 1. Use `advance` instead of `since` and `ago` to time-travel — this is particularly important to keep the returned instance’s class matching `self`. Before this change: today = Date.today # => Tue, 28 Nov 2017 today.class # => Date today.next_occurring(:wednesday) # => Wed, 29 Nov 2017 00:00:00 UTC +00:00 today.next_occurring(:wednesday).class # => ActiveSupport::TimeWithZone After this change, a Date (or Time, or DateTime) instance is properly returned (just like is shown in the new docs). This is generally how everything else in DateAndTime::Calculations works. 2. Move the tests from the DateTime tests to the DateAndTimeBehavior tests. The latter location is mixed in to the core_ext tests for _all_ of Date, Time, and DateTime to test the behavior across all of the classes. The previous location is for testing core_ext functionality added specifically just to DateTime. 3. Better docs!
* | Formatting fix for example codeT.J. Schuck2017-11-282-2/+2
|/ | | | | | | | | | | | | | | | Just cleaning up the formatting of the example code here to format an inline bit of commentary as a comment. Before: ![](https://monosnap.com/file/Clso8IQGOWHU3o6cStbY5NaMPx3ysP.png) After: ![](https://monosnap.com/file/QdbKKvLAeiQ0RucppVYETvaWEstnOI.png) [ci skip]
* Preparing for 5.2.0.beta2 releaseRafael Mendonça França2017-11-282-1/+6
|
* Fix typos and add a few suggestionsFatos Morina2017-11-281-1/+1
|
* Merge pull request #31243 from ignat-z/patch-1Rafael França2017-11-271-8/+6
|\ | | | | [ci skip] Fix documentation for deprecation method_wrappers
| * [ci skip] Fix documentation for deprecation method_wrappersIgnat Zakrevsky2017-11-271-8/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Seems like version with class methods doesn't work. ```ruby require "active_support/deprecation.rb" module Fred extend self def aaa; end def bbb; end def ccc; end def ddd; end def eee; end end ActiveSupport::Deprecation.deprecate_methods(Fred, :aaa, bbb: :zzz, ccc: 'use Bar#ccc instead') Fred.aaa Fred.bbb Fred.ccc ``` # produces nothing vs ```ruby require "active_support/deprecation.rb" class Fred def aaa; end def bbb; end def ccc; end def ddd; end def eee; end end ActiveSupport::Deprecation.deprecate_methods(Fred, :aaa, bbb: :zzz, ccc: 'use Bar#ccc instead') Fred.new.aaa Fred.new.bbb Fred.new.ccc ``` produces ``` DEPRECATION WARNING: aaa is deprecated and will be removed from Rails 5.2 (called from <main> at deprications.rb:15) DEPRECATION WARNING: bbb is deprecated and will be removed from Rails 5.2 (use zzz instead) (called from <main> at deprications.rb:16) DEPRECATION WARNING: ccc is deprecated and will be removed from Rails 5.2 (use Bar#ccc instead) (called from <main> at deprications.rb:17) ```
* | Preparing for 5.2.0.beta1 releaseRafael Mendonça França2017-11-272-1/+3
|/
* Enable `Style/DefWithParentheses` rubocop ruleRyuta Kamizono2017-11-272-2/+2
| | | | | | | The def with blank `()` was newly added in #31176, but we have not used the blank `()` style in most part of our code base. So I've enabled `Style/DefWithParentheses` to prevent to newly added the code.
* Renove duplicated and wrong testRafael Mendonça França2017-11-251-5/+0
|
* Compare the actual string after comparing the HMAC proccessed stringsRafael Mendonça França2017-11-251-1/+1
| | | | | | | | Even that collisions are unlikely we need to make sure the two strings are equal. Timing is not important in this case because this only runs after the comparison between the SHA256 digested strings returns true.
* Merge pull request #24510 from ↵Rafael Mendonça França2017-11-253-10/+31
|\ | | | | | | | | | | vipulnsward/make-variable_size_secure_compare-public Make variable_size_secure_compare public
| * Changed default behaviour of `ActiveSupport::SecurityUtils.secure_compare`,Vipul A M2017-06-073-10/+31
| | | | | | | | | | | | | | to make it not leak length information even for variable length string. Renamed old `ActiveSupport::SecurityUtils.secure_compare` to `fixed_length_secure_compare`, and started raising `ArgumentError` in case of length mismatch of passed strings.
* | Merge pull request #31204 from tjschuck/doc_fix_some_backticks_to_ttRafael França2017-11-229-19/+19
|\ \ | | | | | | Update incorrect backtick usage in RDoc to teletype
| * | Update incorrect backtick usage in RDoc to teletypeT.J. Schuck2017-11-229-19/+19
| | | | | | | | | [ci skip]
* | | Make ActiveSupport::TimeZone.all independent of previous lookups (#31176)Chris LaRose2017-11-223-3/+23
|/ /
* | MemCacheStore: Support expiring countersTakumasa Ochi2017-11-203-2/+31
| | | | | | | | | | | | | | Support `expires_in` in `ActiveSupport::Cache::MemCacheStore#increment` and `#decrement`. Closes #30716.
* | Generate `keys` instead of `keys_to_names`Ryuta Kamizono2017-11-201-3/+3
| | | | | | | | `keys_to_names` is used only for `keys_to_names.keys`.
* | Fix "warning: assigned but unused variable - key"yuuji.yaginuma2017-11-181-1/+1
| | | | | | | | Ref: https://travis-ci.org/rails/rails/jobs/303840778#L1974
* | Merge pull request #31035 from BrentWheeldon/bmw-db-load-deadlockMatthew Draper2017-11-182-0/+72
|\ \ | | | | | | Prevent deadlocks with load interlock and DB lock.
| * | Prevent deadlocks with load interlock and DB lock.Brent Wheeldon2017-11-092-0/+72
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes an issue where competing threads deadlock each other. - Thread A holds the load interlock but is blocked on getting the DB lock - Thread B holds the DB lock but is blocked on getting the load interlock (for example when there is a `Model.transaction` block that needs to autoload) This solution allows for dependency loading in other threads while a thread is waiting to acquire the DB lock. Fixes #31019
* | | Merge pull request #30100 from kirs/doc-reloaderMatthew Draper2017-11-171-0/+3
|\ \ \ | | | | | | | | Document public hooks in AS::Reloader
| * | | Document public hooks in AS::Reloader [ci skip]Kir Shatrov2017-08-141-0/+3
| | | |
* | | | Merge pull request #31128 from rails/handle-ambigious-timesAndrew White2017-11-154-1/+66
|\ \ \ \ | | | | | | | | | | Handle `TZInfo::AmbiguousTime` errors
| * | | | Handle `TZInfo::AmbiguousTime` errorsAndrew White2017-11-154-1/+66
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make `ActiveSupport::TimeWithZone` match Ruby's handling of ambiguous times by choosing the later period, e.g. Ruby: ``` ENV["TZ"] = "Europe/Moscow" Time.local(2014, 10, 26, 1, 0, 0) # => 2014-10-26 01:00:00 +0300 ``` Before: ``` >> "2014-10-26 01:00:00".in_time_zone("Moscow") TZInfo::AmbiguousTime: 26/10/2014 01:00 is an ambiguous local time. ``` After: ``` >> "2014-10-26 01:00:00".in_time_zone("Moscow") => Sun, 26 Oct 2014 01:00:00 MSK +03:00 ``` Fixes #17395.
* | | | | Merge pull request #29776 from mrj/fix-idlw-timezoneMatthew Draper2017-11-151-1/+1
|\ \ \ \ \ | |/ / / / |/| | | | Fix the "International Date Line West" timezone
| * | | | Change the "International Date Line West" TZInfo timezone from ↵Mark James2017-07-131-1/+1
| | | | | | | | | | | | | | | | | | | | "Pacific/Midway" (-11) to "Etc/GMT+12" (-12).
* | | | | These strings should already be frozen where ruby accepts the magic-commentAkira Matsuda2017-11-151-2/+2
| | | | |
* | | | | Fix activesupport/CHANGELOG.md [ci skip]bogdanvlviv2017-11-141-27/+29
| | | | |