aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Add `environment` as dependency of `load_config` (#31135)Yuji Yaginuma2017-11-142-26/+42
| | | | | | | | | | | | Currently the environment is not loaded in some db tasks. Therefore, if use encrypted secrets values in `database.yml`, `read_encrypted_secrets` will not be true, so the value can not be used correctly. To fix this, added `environment` as dependency of `load_config`. It also removes explicit `environment` dependencies that are no longer needed. Fixes #30717
* Built-in Redis cache storeJeremy Daer2017-11-137-15/+684
| | | | | | | | | | | * Supports vanilla Redis, hiredis, and Redis::Distributed. * Supports Memcached-like sharding across Redises with Redis::Distributed. * Fault tolerant. If the Redis server is unavailable, no exceptions are raised. Cache fetches are treated as misses and writes are dropped. * Local cache. Hot in-memory primary cache within block/middleware scope. * `read_/write_multi` support for Redis mget/mset. Use Redis::Distributed 4.0.1+ for distributed mget support. * `delete_matched` support for Redis KEYS globs.
* Merge pull request #30782 from NickLaMuro/improve_performance_of_inflectionsMatthew Draper2017-11-146-10/+31
|\ | | | | Cache regexps generated from acronym_regex
| * Deprecate ActiveSupport::Inflector#acronym_regexNick LaMuro2017-10-285-6/+15
| | | | | | | | | | | | | | | | | | To be removed in Rails 6.0 (default for the deprecate helper). Code moved around as well for the ActiveSupport::Deprecation modules, since it was dependent on ActiveSupport::Inflector being loaded for it to work. By "lazy loading" the Inflector code from within the Deprecation code, we can require ActiveSupport::Deprecation from ActiveSupport::Inflector and not get a circular dependency issue.
| * Cache regexps generated from acronym_regexNick LaMuro2017-10-233-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The Problem ----------- The following line from `String#camelize`: string = string.sub(/^(?:#{inflections.acronym_regex}(?=\b|[A-Z_])|\w)/) { |match| match.downcase } and the following line from `String#camelize`: word.gsub!(/(?:(?<=([A-Za-z\d]))|\b)(#{inflections.acronym_regex})(?=\b|[^a-z])/) { "#{$1 && '_'.freeze }#{$2.downcase}" }#{$2.downcase}" } Both generate the same regexep in the first part of the `.sub`/`.gsub` method calls every time the function is called, creating an extra object allocation each time. The value of `acronym_regex` only changes if the user decides add an acronym to the current set of inflections and apends another string on the the regexp generated here, but beyond that it remains relatively static. This has been around since acronym support was introduced back in 2011 in PR#1648. Proposed Solution ----------------- To avoid re-generating these strings every time these methods are called, cache the values of these regular expressions in the `ActiveSupport::Inflector::Inflections` instance, making it so these regular expressions are only generated once, or when the acronym's are added to. Other notable changes is the attr_readers are nodoc'd, as they shouldn't really be public APIs for users. Also, the new method, define_acronym_regex_patterns, is the only method in charge of manipulating @acronym_regex, and initialize_dup also makes use of that new change. ** Note about fix for non-deterministic actionpack test ** With the introduction of `@acronym_underscore_regex` and `@acronym_camelize_regex`, tests that manipulated these for a short time, then reset them could caused test failures to happen. This happened because the previous way we reset the `@acronyms` and `@acronym_regex` was the set them using #instance_variable_set, which wouldn't run the #define_acronym_regex_patterns method. This has now been introduced into the actionpack tests to avoid this failure.
* | Merge pull request #31145 from dwightwatson/feature/preview-sortingRafael França2017-11-131-1/+1
|\ \ | | | | | | Sort mailer previews alphabetically
| * | Sort mailer previewsDwight Watson2017-11-141-1/+1
|/ /
* | Preserve existing metadata when analyzing a blobGeorge Claghorn2017-11-133-3/+28
| | | | | | | | Closes #31138.
* | Merge pull request #31117 from renuo/fix_errors_addedRafael França2017-11-132-3/+14
|\ \ | | | | | | fix bug on added? method
| * | fix bug on added? methodAlessandro Rodi2017-11-132-3/+14
| | | | | | | | | | | | fix rubocop issues
* | | Properly cast input in `update_all`Sean Griffin2017-11-133-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The documentation claims that given values go through "normal AR type casting and serialization", which to me implies `serialize(cast(value))`, not just serialization. The docs were changed to use this wording in #22492. The tests I cited in that PR (which is the same test modified in this commit), is worded in a way that implies it should be using `cast` as well. It's possible that I originally meant "normal type casting" to imply just the call to `serialize`, but given that `update_all(archived: params['archived'])` seems to be pretty common, I'm inclined to make this change as long as no tests are broken from it.
* | | Merge pull request #30980 from sobrinho/sobrinho/arel-star-ignored-columnsRafael França2017-11-136-45/+68
|\ \ \ | | | | | | | | Do not use `Arel.star` when `ignored_columns`
| * | | Fix postgres ordering issue on default scoping testGabriel Sobrinho2017-11-131-15/+15
| | | |
| * | | Change tests to use models which don't ignore any columnsJon Moss2017-11-133-30/+30
| | | |
| * | | Do not use `Arel.star` when `ignored_columns`Jon Moss2017-11-132-0/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If there are any ignored columns, we will now list out all columns we want to be returned from the database. Includes a regression test.
* | | | Use .tt extension to all the template filesRafael Mendonça França2017-11-13113-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Make clear that the files are not to be run for interpreters. Fixes #23847. Fixes #30690. Closes #23878.
* | | | Merge pull request #31137 from ↵Ryuta Kamizono2017-11-133-11/+9
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | y-yagi/make_sidekiq_and_resque_integration_tests_work_in_ci Make sidekiq and resque integration tests work in ci
| * | | | Make sidekiq and resque integration tests work in CIyuuji.yaginuma2017-11-133-9/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 8f2490b, the integration test of sidekiq and resque is not working in CI. https://travis-ci.org/rails/rails/jobs/301276197#L2055 https://travis-ci.org/rails/rails/jobs/301276197#L2061 Because 8f2490b removed password from `redis-server`. So must also remove passwords from these tests.
| * | | | Return a non zero code when can not connect to redis in CIyuuji.yaginuma2017-11-132-2/+4
| | | | |
* | | | | Add new error class `StatementTimeout` which will be raised when statement ↵Ryuta Kamizono2017-11-136-2/+73
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | timeout exceeded (#31129) We are sometimes using The MAX_EXECUTION_TIME hint for MySQL depending on the situation. It will prevent catastrophic performance down by wrong performing queries. The new error class `StatementTimeout` will make to be easier to handle that case. https://dev.mysql.com/doc/refman/5.7/en/optimizer-hints.html#optimizer-hints-execution-time
* | | | | Merge pull request #31139 from avneetmalhotra/touch_callback_documentation_fixRyuta Kamizono2017-11-131-1/+1
|\ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Move touch method from Skipping Callbacks section to Running Callback… [ci skip]
| * | | | | Move touch method from Skipping Callbacks section to Running Callbacks ↵Avneet Singh Malhotra2017-11-131-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | section [ci skip]
* | | | | | Merge pull request #30893 from y-yagi/verify_credentials_format_before_savingKasper Timm Hansen2017-11-132-1/+15
|\ \ \ \ \ \ | |_|/ / / / |/| | | | | Verify credentials format before saving
| * | | | | Verify credentials format before savingyuuji.yaginuma2017-11-132-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, credentials does not check the format when saving. As a result, incorrect data as yaml is also saved. If credentials is used in config files., an error will occur in credential yaml parsing before edit, and will not be able to edit it. In order to prevent this, verify the format when saving. Related: #30851
* | | | | | Action Cable: run Redis tests against a default config without a passwordJeremy Daer2017-11-132-3/+22
| |/ / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Simplify our dev testing and CI story since we're also testing against Redis for the Active Support cache store. Directly test whether db, host, password, etc are passed through as config instead of spinning up a Redis server with a password set on it.
* | | | | Merge pull request #30773 from y-yagi/fix_30765Eileen M. Uchitelle2017-11-123-1/+36
|\ \ \ \ \ | | | | | | | | | | | | Make automatically synchronize test schema work inside engine
| * | | | | Make automatically synchronize test schema work inside engineyuuji.yaginuma2017-10-023-1/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Rails engine, migration files are in under `db/migrate` of engine. Therefore, when rake task is executed in engine, `db/migrate` is automatically added to `DatabaseTasks.migrations_paths`. https://github.com/rails/rails/blob/a18cf23a9cbcbeed61e8049442640c7153e0a8fb/activerecord/lib/active_record/railtie.rb#L39..L43 However, if execute the rake task under dummy app, migration files will not be loaded because engine's migration path setting process is not called. Therefore, in order to load migration files correctly, it is necessary to execute rake task under engine. Fixes #30765
* | | | | | Merge pull request #30791 from felipecvo/nested-attributes-docEileen M. Uchitelle2017-11-121-0/+12
|\ \ \ \ \ \ | | | | | | | | | | | | | | Add update_only example to AR nested attributes doc [ci_skip]
| * | | | | | Add update_only example to AR nested attributes doc [ci_skip]Felipe Oliveira2017-10-031-0/+12
| | | | | | |
* | | | | | | Revert displaying master key generation info on `rails new`.Kasper Timm Hansen2017-11-123-23/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's already a default for new apps, like so many others, so no need to flaunt it.
* | | | | | | Deprecate encrypted secrets in favor of credentials.Kasper Timm Hansen2017-11-126-167/+50
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Allow edits of existing encrypted secrets generated on Rails 5.1, but refer to credentials when attempting to setup. This also removes the need for any of the setup code, so the generator can be ripped out altogether.
* | | | | | | Merge pull request #30770 from ↵Kasper Timm Hansen2017-11-123-2/+5
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | y-yagi/do_not_create_credential_in_dummy_application Do not create credentials in dummy application
| * | | | | | | Do not create credentials in dummy applicationyuuji.yaginuma2017-10-023-2/+5
| | |/ / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | Because dummy application is only for use test, so credentials is unnecessary.
* | | | | | | Merge pull request #31131 from y-yagi/remove_unused_requiresRyuta Kamizono2017-11-121-2/+0
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Remove unused require
| * | | | | | | Remove unused requireyuuji.yaginuma2017-11-121-2/+0
| | | | | | | |
* | | | | | | | Raise `TransactionTimeout` when lock wait timeout exceeded for PG adapterRyuta Kamizono2017-11-114-3/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow up of #30360.
* | | | | | | | Should test actual error which is raised from the databaseRyuta Kamizono2017-11-111-1/+23
|/ / / / / / /
* | | | | | | Add missing autoload `Type` (#31123)Ryuta Kamizono2017-11-1119-17/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Attribute modules (`Attribute`, `Attributes`, `AttributeSet`) uses `Type`, but referencing `Type` before the modules still fail. ``` % ./bin/test -w test/cases/attribute_test.rb -n test_with_value_from_user_validates_the_value Run options: -n test_with_value_from_user_validates_the_value --seed 31876 E Error: ActiveModel::AttributeTest#test_with_value_from_user_validates_the_value: NameError: uninitialized constant ActiveModel::AttributeTest::Type /Users/kamipo/src/github.com/rails/rails/activemodel/test/cases/attribute_test.rb:233:in `block in <class:AttributeTest>' bin/test test/cases/attribute_test.rb:232 Finished in 0.002985s, 335.0479 runs/s, 335.0479 assertions/s. 1 runs, 1 assertions, 0 failures, 1 errors, 0 skips ``` Probably we need more autoloading at least `Type`.
* | | | | | | Relation merging should keep joining orderRyuta Kamizono2017-11-112-10/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `joins_values.partition` will break joins values order. It should be kept as user intended order. Fixes #15488.
* | | | | | | Add missing require "active_support/core_ext/hash/indifferent_access"Ryuta Kamizono2017-11-101-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | https://travis-ci.org/rails/rails/jobs/300163454#L2236
* | | | | | | Fix random CI failure due to non-deterministic sorting orderRyuta Kamizono2017-11-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | https://travis-ci.org/rails/rails/jobs/300163487#L1974
* | | | | | | Consolidate duplicated `to_ary`/`to_a` definitions in `Relation` and ↵Ryuta Kamizono2017-11-103-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | `CollectionProxy`
* | | | | | | Ensure `apply_join_dependency` for subqueries in `from` and `where`Ryuta Kamizono2017-11-103-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #21577.
* | | | | | | :scissors:Ryuta Kamizono2017-11-101-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | [ci skip]
* | | | | | | Adjust blank linesRyuta Kamizono2017-11-104-4/+5
| | | | | | |
* | | | | | | Merge pull request #31065 from bogdan/cleanup-cache-keyAndrew White2017-11-101-26/+11
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Remove code duplication in ActiveSupport::Cache
| * | | | | | | Remove code duplication in ActiveSupport::CacheBogdan Gusiev2017-11-091-26/+11
| | | | | | | |
* | | | | | | | Merge pull request #31119 from y-yagi/add_missing_requiresRyuta Kamizono2017-11-101-0/+1
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Add missing requires
| * | | | | | | | Add missing requiresyuuji.yaginuma2017-11-101-0/+1
|/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently, executing the test with only `attribute_test.rb` results in an error. ``` ./bin/test -w test/cases/attribute_test.rb Run options: --seed 41205 # Running: ....E Error: ActiveModel::AttributeTest#test_attributes_do_not_equal_attributes_with_different_types: NameError: uninitialized constant ActiveModel::AttributeTest::Type rails/activemodel/test/cases/attribute_test.rb:159:in `block in <class:AttributeTest>' bin/test test/cases/attribute_test.rb:158 ``` Added a missing require to fix this.
* | | | | | | | Remove useless preloader classesRyuta Kamizono2017-11-1010-104/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They are only different by one line of code which doesn't deserve a hierarchy of 7 classes. Closes #31079. [Ryuta Kamizono & Bogdan Gusiev]