aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support
Commit message (Collapse)AuthorAgeFilesLines
...
* | | Add missing instrumentation to RedisCacheStore#read_multifatkodima2018-02-051-1/+5
| | |
* | | Redis cache store: consolidate serializationJeremy Daer2018-02-041-17/+21
| | | | | | | | | | | | Use `serialize_entry` throughout and introduce `serialize_entries`.
* | | RedisCacheStore: fix `#write_multi` mset serializationfatkodima2018-02-041-1/+8
| |/ |/| | | | | | | Closes #31886 Fixes #31884
* | Revert "Merge pull request #31447 from fatkodima/redis_cache-connection_pool"George Claghorn2018-01-313-71/+23
| | | | | | | | | | This reverts commit ac74e2c521f6ddc0eac02d74a1313261bcc1d60f, reversing changes made to ffdb06136152b3c5f7f4a93ca5928e16e755d228.
* | Update default deprecation horizonYuji Yaginuma2018-01-311-1/+1
| | | | | | | | Because the master branch is already 6.0.
* | Start Rails 6.0 development!!!Rafael Mendonça França2018-01-301-3/+3
| | | | | | | | :tada::tada::tada:
* | Merge pull request #31803 from rmosolgo/rm-dependenciesRafael França2018-01-261-0/+1
|\ \ | | | | | | Fix infinite loop when unloading autoloaded modules
| * | Remove duplicates after autoloading modulesRobert Mosolgo2018-01-261-0/+1
| | |
* | | Improve fault tolerance for redis cache storefatkodima2018-01-231-4/+11
| | |
* | | Add support for connection pooling on RedisCacheStorefatkodima2018-01-223-23/+71
|/ /
* | Merge pull request #31732 from ↵Matthew Draper2018-01-197-8/+8
|\ \ | | | | | | | | | | | | koic/enable_autocorrect_for_lint_end_alignment_cop Enable autocorrect for `Lint/EndAlignment` cop
| * | Enable autocorrect for `Lint/EndAlignment` copKoichi ITO2018-01-187-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ### Summary This PR changes .rubocop.yml. Regarding the code using `if ... else ... end`, I think the coding style that Rails expects is as follows. ```ruby var = if cond a else b end ``` However, the current .rubocop.yml setting does not offense for the following code. ```ruby var = if cond a else b end ``` I think that the above code expects offense to be warned. Moreover, the layout by autocorrect is unnatural. ```ruby var = if cond a else b end ``` This PR adds a setting to .rubocop.yml to make an offense warning and autocorrect as expected by the coding style. And this change also fixes `case ... when ... end` together. Also this PR itself is an example that arranges the layout using `rubocop -a`. ### Other Information Autocorrect of `Lint/EndAlignment` cop is `false` by default. https://github.com/bbatsov/rubocop/blob/v0.51.0/config/default.yml#L1443 This PR changes this value to `true`. Also this PR has changed it together as it is necessary to enable `Layout/ElseAlignment` cop to make this behavior.
* | | Support hash as first argument in `assert_difference`. (#31600)Julien Meichelbeck2018-01-181-7/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Support hash as first argument for `assert_difference`. This allows to specify multiple numeric differences in the same assertion. Example: assert_difference 'Article.count' => 1, 'Notification.count' => 2 do # post :create, params: { article: {...} } end * Support error message when passing a hash as a first parameter * Format CHANGELOG properly [Julien Meichelbeck + Rafael Mendonça França]
* | | Support for connection pooling on mem cache storeGabriel Sobrinho2018-01-181-9/+25
| | |
* | | Convert keys to binary in the Redis cache storeGeorge Claghorn2018-01-171-1/+1
|/ / | | | | | | Fix encoding errors when using the pure-Ruby Redis driver instead of Hiredis. Dodge incompatibilities between UTF-8 and arbitrary value encodings, which rear their heads when the Redis driver tries to build a single command string from incompatibly-encoded keys and values.
* | Fix constant referenceGeorge Claghorn2018-01-161-1/+1
| | | | | | | | Update the long key handling test so it triggers truncation in the Redis cache store.
* | Merge pull request #31651 from eugeneius/use_sha1_digestsSean Griffin2018-01-121-3/+4
|\ \ | | | | | | Use SHA-1 for non-sensitive digests by default
| * | Use SHA-1 for non-sensitive digests by defaultEugene Kenny2018-01-081-3/+4
| | | | | | | | | | | | | | | | | | Instead of providing a configuration option to set the hash function, switch to SHA-1 for new apps and allow upgrading apps to opt in later via `new_framework_defaults_5_2.rb`.
* | | Merge pull request #30268 from ignatiusreza/instrumentationRyuta Kamizono2018-01-112-43/+54
|\ \ \ | | | | | | | | | | | | add instrumentation for read_multi
| * | | add instrumentation for read_multiIgnatius Reza2017-12-292-43/+54
| | | | | | | | | | | | | | | | currently it's not possible to know what the hit rates are from read_multi
* | | | Merge pull request #31624 from y-yagi/fix_minitest_511Aaron Patterson2018-01-101-2/+4
|\ \ \ \ | | | | | | | | | | Add support for Minitest 5.11
| * | | | Use `Minitest::Result` for retain test resultyuuji.yaginuma2018-01-031-2/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Runnable.marshal_dump/load was removed in https://github.com/seattlerb/minitest/commit/00433fc0a4fdd0e6b302aace633384ba1312237 Instead, `Minitest::Result` is contained test result and the that can be marshalled.
* | | | | Fix "the the " [ci skip]Ryuta Kamizono2018-01-101-1/+1
| | | | |
* | | | | Merge pull request #29685 from ayanko/fix-slow-name-error-missing-nameRyuta Kamizono2018-01-101-0/+5
|\ \ \ \ \ | |_|_|/ / |/| | | | Fix performance issue with NameError#missing_name on ruby >= v2.3.0.
| * | | | Fix performance issue with NameError#missing_name on ruby >= v2.3.0.Andriy Yanko2017-07-101-0/+5
| | | | | | | | | | | | | | | | | | | | | | | | | Since ruby v2.3.0 `did_you_mean` gem shipped and ENABLED by default. It patches NameError#message with spell corrections which are SLOW.
* | | | | Remove meaningless checkyuuji.yaginuma2018-01-081-1/+1
| | | | | | | | | | | | | | | | | | | | `ActiveSupport::OrderedOptions` responds to any message.
* | | | | Allow use_authenticated_message_encryption to be set in ↵Eugene Kenny2018-01-072-5/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | new_framework_defaults_5_2.rb Enabling this option in new_framework_defaults_5_2.rb didn't work before, as railtie initializers run before application initializers. Using `respond_to?` to decide whether to set the option wasn't working either, as `ActiveSupport::OrderedOptions` responds to any message.
* | | | | Merge pull request #31049 from gwincr11/cg-blankRyuta Kamizono2018-01-041-1/+10
|\ \ \ \ \ | | | | | | | | | | | | Add support for multiple encodings in String.blank?
| * | | | | Add support for multiple encodings in String.blank?Cory Gwin @gwincr112017-11-171-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Motivation: - When strings are encoded with `.encode("UTF-16LE")` `.blank?` throws an `Encoding::CompatibilityError` exception. - We tested multiple implementation to see what the fastest implementation was, rescueing the execption seems to be the fastest option we could find. Related Issues: - #28953 Changes: - Add a rescue to catch the exception. - Added a `Concurrent::Map` to store a cache of encoded regex objects for requested encoding types. - Use the new `Concurrent::Map` cache to return the correct regex for the string being checked.
* | | | | | Merge pull request #31011 from ↵Ryuta Kamizono2018-01-041-5/+6
|\ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | danielma/dma/assert-changes-with-to-should-still-assert-change `assert_changes` should always assert some change
| * | | | | | `assert_changes` should always assert some changeDaniel Ma2017-11-131-5/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While using `assert_changes`, I came across some unexpected behavior: if you provide a `to:` argument, and the expression matches but didn't actually change, the assertion will pass. The way `assert_changes` reads, I assumed that it would both assert that there was any change at all, _and_ that the expression changed to match my `to:` argument. In the case of just a `from:` argument, `assert_changes` does what I expect as well. It asserts that the before value `=== from` and that the after value changed. My key change is that `assert_changes` will now _always_ assert that expression changes, no matter what combination of `from:` and `to:` arguments
* | | | | | | Remove undefined `track_deletion` callback [ci skip]Ryuta Kamizono2018-01-031-3/+0
| |_|_|/ / / |/| | | | |
* | | | | | Merge pull request #31310 from kinnrot/duration-moduloRyuta Kamizono2018-01-011-1/+3
|\ \ \ \ \ \ | |_|_|_|/ / |/| | | | | Duration created with no parts will have a default seconds part eqaul to 0
| * | | | | Empty duration inspect fixChen Kinnrot2017-12-131-1/+3
| | | | | |
* | | | | | Revert "Remove code duplication in ActiveSupport::Cache"George Claghorn2017-12-221-11/+26
| | | | | | | | | | | | | | | | | | | | | | | | This reverts commit 57f0e3d1300d01444d2a311560c055d26968dc3f.
* | | | | | Merge pull request #31348 from y-yagi/fix_31283Kasper Timm Hansen2017-12-182-7/+8
|\ \ \ \ \ \ | | | | | | | | | | | | | | Raise an error only when `require_master_key` is specified
| * | | | | | Raise an error only when `require_master_key` is specifiedyuuji.yaginuma2017-12-182-7/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-172-11/+3
|/ / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-152-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `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-144-3/+37
|\ \ \ \ \ \ | | | | | | | | | | | | | | Initial support for running Rails on FIPS-certified systems
| * | | | | | Introduced `ActiveSupport::Digest` that allows to specify hash function ↵Dmitri Dolguikh2017-12-124-3/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | implementation and defaults to `Digest::MD5`. Replaced calls to `::Digest::MD5.hexdigest` with calls to `ActiveSupport::Digest.hexdigest`.
* | | | | | | Preserve original method visibility when deprecating a methodJordan Brough2017-12-131-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | | | | | 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
| | | | | |