aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | | | Merge pull request #33844 from kamipo/too_many_eager_load_idsRyuta Kamizono2018-09-136-5/+29
|\ \ \ \ \ \ | |/ / / / / |/| | | | | Eager loading/preloading should be worked regardless of large number of records
| * | | | | Eager loading/preloading should be worked regardless of large number of recordsRyuta Kamizono2018-09-126-5/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 213796f, bind params are used for IN clause if enabled prepared statements. Unfortunately, most adapter modules have a limitation for # of bind params (mysql2 65535, pg 65535, sqlite3 250000). So if eager loading large number of records at once, that query couldn't be sent to the database. Since eager loading/preloading queries are auto-generated by Active Record itself, so it should be worked regardless of large number of records like as before. Fixes #33702.
* | | | | | Merge pull request #33860 from jhawthorn/faster_find_templatesRafael França2018-09-121-13/+53
|\ \ \ \ \ \ | | | | | | | | | | | | | | Use faster globs for template resolving
| * | | | | | Fix for variants: :any special caseJohn Hawthorn2018-09-121-1/+3
| | | | | | |
| * | | | | | Use wildcard glob for optimized template resolvingJohn Hawthorn2018-09-121-13/+51
| | | | | | |
* | | | | | | Add a test that exercice better the behavior we expect in the query cacheRafael Mendonça França2018-09-121-2/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In production the query cache was already being loaded before the first request even without #33856, so added a test to make sure of it. This new test is passing even if #33856 is reverted.
* | | | | | | Merge pull request #33849 from ↵Rafael França2018-09-122-1/+8
|\ \ \ \ \ \ \ | |/ / / / / / |/| | | | | | | | | | | | | | | | | | | | ricardotk002/include-helpers-action-dispatch-integration-test Include test helpers in ActionDispatch::IntegrationTest
| * | | | | | Include test helpers when ActionDispatch::IntegrationTest is loadedRicardo Díaz2018-09-122-1/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As @dhh brings up, the point of `ActionDispatch::IntegrationTest` is to allow users to test the integration of all the pieces called by a controller. Asserting about the emails and jobs queued is part of that task. This commit includes the `ActionMailer::TestHelper` and `ActiveJob::TestHelper` modules when the ActionMailer and ActiveJob railties are initialized respectively.
* | | | | | | Merge pull request #33854 from rigani/integer-multipleRafael França2018-09-121-1/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Faster multiple_of? method
| * | | | | | | Faster multiple_of? methodrigani2018-09-121-1/+1
| | | | | | | |
* | | | | | | | Merge pull request #33832 from bogdanvlviv/follow-up-33756Rafael França2018-09-125-31/+55
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Follow up #33756
| * | | | | | | | Add mention about `ActiveRecord::Base::filter_attributes` to the changelog entrybogdanvlviv2018-09-122-8/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also remove `# :nodoc:` for `ActiveRecord::Core::ClassMethods` in order to show non-nodoc methods in that module on the api docs http://edgeapi.rubyonrails.org
| * | | | | | | | Build string set when `filter_attributes` is assignedbogdanvlviv2018-09-122-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It would allow `filter_attributes` to be reused across multiple calls to `#inspect` or `#pretty_print`. - Add `require "set"` - Remove `filter_attributes` instance reader. I think there is no need to keep it.
| * | | | | | | | DRY `activerecord/lib/active_record/core.rb` and fix testsbogdanvlviv2018-09-122-20/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - Move ``` filter_attributes = self.filter_attributes.map(&:to_s).to_set filter_attributes.include?(attribute_name) && !read_attribute(attribute_name).nil? ``` to private method. - Fix tests in `activerecord/test/cases/filter_attributes_test.rb` - Ensure that `teardown` sets `ActiveRecord::Base.filter_attributes` to previous state. - Ensure that `Admin::Account.filter_attributes` is set to previous state in the "filter_attributes could be overwritten by models" test. Follow up #33756
| * | | | | | | | Clarify docs of `config.filter_parameters` and `#filter_attributes`bogdanvlviv2018-09-122-2/+2
|/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add mention that `config.filter_parameters` also filters out sensitive values of database columns when call `#inspect` since #33756.
* | | | | | | | Merge pull request #33856 from ↵Eileen M. Uchitelle2018-09-122-3/+34
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | eileencodes/fix-query-cache-to-load-before-first-request Fix query cache to load before first request
| * | | | | | | | Fix query cache to load before first requestEileen Uchitelle2018-09-122-3/+34
|/ / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In a test app we observed that the query cache was not enabled on the first request. This was because the query cache hooks are installed on load and active record is loaded in the middle of the first request. If we remove the `on_load` from the railtie the query cache hooks will be installed before the first request, allowing the cache to be enabled on that first request. This is ok because query cache doesn't load anything else, only itself so we're not eager loading all of active record before the first request, just the query cache hooks. [Eileen M. Uchitelle & Matthew Draper]
* | | | | | | | Merge pull request #33852 from sharang-d/patch-2Yuji Yaginuma2018-09-121-1/+1
|\ \ \ \ \ \ \ \ | |/ / / / / / / |/| | | | | | | Update test_helper_test.rb
| * | | | | | | Update test_helper_test.rbSharang Dashputre2018-09-121-1/+1
|/ / / / / / / | | | | | | | | | | | | | | Fix typo `wiht` -> `with`
* | | | | | | Merge pull request #33848 from sharang-d/patch-2Rafael França2018-09-111-1/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Update action_mailer_basics.md
| * | | | | | | Update action_mailer_basics.md [ci skip]Sharang Dashputre2018-09-121-1/+1
|/ / / / / / / | | | | | | | | | | | | | | | | | | | | | Add backticks to code
* | | | | | | Merge pull request #33819 from kevindew/yarn-pathRafael França2018-09-111-1/+1
|\ \ \ \ \ \ \ | | | | | | | | | | | | | | | | Run yarn install relative to Rails.root
| * | | | | | | Run yarn install relative to Rails.rootKevin Dew2018-09-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | We may not always have binstubs relative to the directory we are running the rake task from. The particular case for this is with a mountable Rails engine and dummy app that is created to test it. This sets all the tasks up to run under an `app` namespace in railties/lib/rails/tasks/engine.rake This change resolves a problem whereby running `app:yarn:install` would have no effect as it would try to run in the plugins bin directory rather than the test/dummy/bin. This also means that it installs from test/dummy/package.json and into test/dummy/node_modules which is behaviour consistent with a normal Rails app. On a rails engine: ``` ➜ tmp rails plugin new rails-plugin --mountable ➜ tmp cd rails-plugin ``` Before this change: ``` ➜ rails-plugin rake app:yarn:install ➜ rails-plugin ``` After this change: ``` ➜ rails-plugin rake app:yarn:install yarn install v1.9.4 info No lockfile found. [1/4] 🔍 Resolving packages... [2/4] 🚚 Fetching packages... [3/4] 🔗 Linking dependencies... [4/4] 📃 Building fresh packages... ✨ Done in 0.07s. ``` When this change is ran against a normal rails install there is not a behavioural change: ``` ➜ tmp rails new full-app ➜ tmp cd full-app ➜ full-app git:(master) ✗ rake yarn:install yarn install v1.9.4 info No lockfile found. [1/4] 🔍 Resolving packages... [2/4] 🚚 Fetching packages... [3/4] 🔗 Linking dependencies... [4/4] 📃 Building fresh packages... ✨ Done in 0.09s. ```
* | | | | | | | Merge pull request #33483 from DylanReile/masterRafael França2018-09-111-0/+2
|\ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | Disable content security policy for mailer previews
| * | | | | | | | Disable content security policy for mailer previewsDylan Reile2018-07-301-0/+2
| | | | | | | | |
* | | | | | | | | Merge pull request #27792 from tjoyal/sandbox-tagged-loggingRafael Mendonça França2018-09-113-10/+35
|\ \ \ \ \ \ \ \ \ | |_|_|/ / / / / / |/| | | | | | | | | | | | | | | | | TaggedLogging to return a new logger instance
| * | | | | | | | TaggedLogging to return a new logger instanceThierry Joyal2017-02-273-10/+34
| | | | | | | | |
* | | | | | | | | Merge pull request #33821 from schneems/schneems/digester-no-arrayRichard Schneeman2018-09-112-10/+22
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Move digest path calculation out of loop
| * | | | | | | | | Move digest path calculation out of loopschneems2018-09-112-10/+22
| | |_|_|/ / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | On every iteration of generating a cache for a collection a “digest path” is calculated even though it’s exactly the same for every element. This PR exposes a method `digest_path_from_virtual` that returns back a “digest_path”. This can in turn be passed back into `cache_fragment_name`. This not only does less work, but it also (you guessed it) uses less memory. before: Total allocated: 762539 bytes (7035 objects) after: Total allocated: 743590 bytes (6621 objects) (762539 - 743590)/ 762539.0 # => 2.4% faster ⚡️⚡️
* | | | | | | | | Merge pull request #33815 from mberlanda/mberlanda/enhance-config-forRafael França2018-09-112-3/+53
|\ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | Use ActiveSupport::InheritableOptions and deep_symbolize_keys in config_for
| * | | | | | | | | refacto: config_for with ActiveSupport::InheritableOptions and symbolized keysMauro Berlanda2018-09-112-3/+53
| | | | | | | | | |
* | | | | | | | | | use "minitest" consistentlyXavier Noria2018-09-1117-21/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The name of the minitest library is spelled that way: regular font, and lowercase. Lowercase is used even at the beginning of sentences, see http://docs.seattlerb.org/minitest/ I double-checked this with @zenspider too (thanks!).
* | | | | | | | | | Merge pull request #33795 from marceloperini/marceloperini/33450-active-storageRafael França2018-09-113-1/+12
|\ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | Fix zero-byte files upload in #33630
| * | | | | | | | | | Fix zero-byte files uploadMarcelo Perini Veloso2018-09-063-1/+12
| | | | | | | | | | |
* | | | | | | | | | | Merge pull request #33785 from bogdanvlviv/follow-up-33773-33779Rafael França2018-09-111-1/+1
|\ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | Clarify changelog entry added in #33779 [ci skip]
| * | | | | | | | | | | Clarify changelog entry added in #33779 [ci skip]bogdanvlviv2018-09-031-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Related to #33773
* | | | | | | | | | | | Merge pull request #33824 from yskkin/suppress_loggingRafael França2018-09-117-23/+58
|\ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | Skip delivery notification when perform_deliveries is false.
| * | | | | | | | | | | | Add `perform_deliveries` to a payload of `deliver.action_mailer` notification.Yoshiyuki Kinjo2018-09-095-27/+41
| | | | | | | | | | | | |
| * | | | | | | | | | | | Skip delivery notification when perform_deliveries is false.Yoshiyuki Kinjo2018-09-085-1/+22
| | | | | | | | | | | | |
* | | | | | | | | | | | | Use utf8mb4 character set by default for MySQL database (#33608)Yasuo Honda2018-09-119-12/+25
| |_|_|_|/ / / / / / / / |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Use utf8mb4 character set by default `utf8mb4` character set supports supplementary characters including emoji. `utf8` character set with 3-Byte encoding is not enough to support them. There was a downside of 4-Byte length character set with MySQL 5.5 and 5.6: "ERROR 1071 (42000): Specified key was too long; max key length is 767 bytes" for Rails string data type which is mapped to varchar(255) type. MySQL 5.7 supports 3072 byte key prefix length by default. * Remove `DEFAULT COLLATE` from Active Record unit test databases There should be no "one size fits all" collation in MySQL 5.7. Let MySQL server choose the default collation for Active Record unit test databases. Users can choose their best collation for their databases by setting `options[:collation]` based on their requirements. * InnoDB FULLTEXT indexes support since MySQL 5.6 it does not have to use MyISAM storage engine whose maximum key length is 1000 bytes. Using MyISAM storag engine with utf8mb4 character set would cause "Specified key was too long; max key length is 1000 bytes" https://dev.mysql.com/doc/refman/5.6/en/innodb-fulltext-index.html * References "10.9.1 The utf8mb4 Character Set (4-Byte UTF-8 Unicode Encoding)" https://dev.mysql.com/doc/refman/5.7/en/charset-unicode-utf8mb4.html "10.9.2 The utf8mb3 Character Set (3-Byte UTF-8 Unicode Encoding)" https://dev.mysql.com/doc/refman/5.7/en/charset-unicode-utf8.html "14.8.1.7 Limits on InnoDB Tables" https://dev.mysql.com/doc/refman/5.7/en/innodb-restrictions.html > If innodb_large_prefix is enabled (the default), the index key prefix limit is 3072 bytes > for InnoDB tables that use DYNAMIC or COMPRESSED row format. * CI against MySQL 5.7 Followed this instruction and changed root password to empty string. https://docs.travis-ci.com/user/database-setup/#MySQL-57 * The recommended minimum version of MySQL is 5.7.9 to support utf8mb4 character set and `innodb_default_row_format` MySQL 5.7.9 introduces `innodb_default_row_format` to support 3072 byte length index by default. Users do not have to change MySQL database configuration to support Rails string type. https://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_default_row_format https://dev.mysql.com/doc/refman/5.7/en/innodb-restrictions.html > If innodb_large_prefix is enabled (the default), > the index key prefix limit is 3072 bytes for InnoDB tables that use DYNAMIC or COMPRESSED row format. * The recommended minimum version of MariaDB is 10.2.2 MariaDB 10.2.2 is the first version of MariaDB supporting `innodb_default_row_format` Also MariaDB says "MySQL 5.7 is compatible with MariaDB 10.2". - innodb_default_row_format https://mariadb.com/kb/en/library/xtradbinnodb-server-system-variables/#innodb_default_row_format - "MariaDB versus MySQL - Compatibility" https://mariadb.com/kb/en/library/mariadb-vs-mysql-compatibility/ > MySQL 5.7 is compatible with MariaDB 10.2 - "Supported Character Sets and Collations" https://mariadb.com/kb/en/library/supported-character-sets-and-collations/
* | | | | | | | | | | | Don't expose `instantiate_instance_of` for internal useRyuta Kamizono2018-09-111-11/+7
| | | | | | | | | | | |
* | | | | | | | | | | | Refactor object creation from relation to avoid pushing scope attributesRyuta Kamizono2018-09-112-24/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Pushing scope attributes was added at d4007d5 for fixing inheritance object creation. But it was not a better fix, since we could just pull that on demand in `Inheritance` module.
* | | | | | | | | | | | Don't expose `current_scope` for internal useRyuta Kamizono2018-09-113-18/+17
| | | | | | | | | | | |
* | | | | | | | | | | | Move `scoping` handling into klass level from relationRyuta Kamizono2018-09-112-5/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I'd like to use this `scoping` handling on klass level to address unwanted internal scoping issues.
* | | | | | | | | | | | Remove redundant `all.scoping`Ryuta Kamizono2018-09-111-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `scoping` stashes the reciever and then returning that as `klass.all`. `all.scoping` has no effect to the public behavior, so it is redundant.
* | | | | | | | | | | | Remove unused `existing` arg in `SelectManager#collapse`Ryuta Kamizono2018-09-111-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The `existing` arg was added at 8bc0fce, but it is no longer used since aac9da2.
* | | | | | | | | | | | Merge pull request #33639 from ↵Ryuta Kamizono2018-09-115-7/+61
|\ \ \ \ \ \ \ \ \ \ \ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | darwin67/33610-duplicated-nested-records-with-create_with Make sure there are no duplicated nested records with create_with
| * | | | | | | | | | | | Fixes #33610Darwin D Wu2018-09-115-7/+61
|/ / / / / / / / / / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to avoid double assignments of nested_attributes for `has_many` relations during record initialization, nested_attributes in `create_with` should not be passed into `klass.new` and have them populate during `initialize_internals_callback` with scope attributes. However, `create_with` keys should always have precedence over where clauses, so if there are same keys in both `create_with` and `where_values_hash`, the value in `create_with` should be the one that's used.
* | | | | | | | | | | | Use correct variableyuuji.yaginuma2018-09-112-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Follow up of 3e81490717a314437f9123d86fa3e9dc55558e95.
* | | | | | | | | | | | Oxford comma [ci skip]Xavier Noria2018-09-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Followup to a recently merged PR, too minor and detailed to require a modification to the contributed patch.