aboutsummaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* Make `assert_<enqueued|performed>_with()` compare hashes ignoring order of keysSharang Dashputre2018-09-213-9/+38
| | | | The test helpers now treat `{ a: 1, b: 2 }` and `{ b: 2, a: 1 }` as equals
* Merge pull request #33112 from yahonda/ci_postgresql10Rafael França2018-09-201-3/+48
|\ | | | | CI against PostgreSQL 10
| * CI against PostgreSQL 10Yasuo Honda2018-09-181-3/+48
| | | | | | | | | | | | | | | | | | | | - Replace port number 5433 to 5432 (default value) which Active Record unit tests expect - Restart PostgreSQL 10 service after changing port number - PostgreSQL 10 is a addon for the current Travis CI. Installing PostgreSQL 10 would cause longer CI to getting additional apt packages Refer https://docs.travis-ci.com/user/database-setup/#PostgreSQL - Use `sudo: required` for railties CI expecting PostgreSQL is up and running
* | Merge pull request #33925 from rafaelfranca/rm-fix-column_defaultsSean Griffin2018-09-202-1/+15
|\ \ | | | | | | Make a deep copy of the _default_attributes in column_defaults
| * | Make a deep copy of the _default_attributes in column_defaultsRafael Mendonça França2018-09-202-1/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When column_defaults is called it calls `value` on each instance of Attribute inside the _default_attributes set. Since value is memoized in the Attribute instance and that Attribute instance is shared across all instances of a model the next call to the default value will be memozied not running the proc defined by the user. Fixes #33031.
* | | Merge pull request #33929 from yahonda/update_utf8mb4_railsguideRyuta Kamizono2018-09-201-1/+2
|\ \ \ | | | | | | | | Update MySQL server version and character set in Rails Guide [skip ci]
| * | | Update MySQL server version and character set in Rails Guide [skip ci]Yasuo Honda2018-09-201-1/+2
| | |/ | |/| | | | | | | Related to #33853
* | | Merge pull request #33928 from freeletics/fix-key-envYuji Yaginuma2018-09-204-12/+8
|\ \ \ | | | | | | | | Fixed to RAILS_MASTER_KEY as a default env key for decrypting.
| * | | Fixed to RAILS_MASTER_KEY as a default env key for decrypting.Wojciech Wnętrzak2018-09-204-12/+8
|/ / / | | | | | | | | | | | | Fixes mistake left in https://github.com/rails/rails/pull/33521/files#diff-2a29095afcfe2c683b82a779a94c2208R59 and misunderstanding in https://github.com/rails/rails/commit/d69b04de0ff33237209afea6f6cac3ab27934908
* | | Fix deprecation hash warning - activerecord testVitor Oliveira2018-09-201-1/+1
| | |
* | | Merge pull request #33927 from bogdanvlviv/follow-up-33912Ryuta Kamizono2018-09-201-5/+2
|\ \ \ | | | | | | | | Make `ActiveRecord::Result#to_a` as alias to `ActiveRecord::Result#to_ary`
| * | | Make `ActiveRecord::Result#to_a` as alias to `ActiveRecord::Result#to_ary`bogdanvlviv2018-09-201-5/+2
|/ / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `ActiveRecord::Result#to_a` was introduced in #33912. I would prefer to make `to_a` as alias to the `to_ary` because: - It would be clear for users from https://edgeapi.rubyonrails.org/classes/ActiveRecord/Result.html that `to_a` and `to_ary` are the same - For us it would take less efforts in case if we needed to change the docs or implementation, since the methods are the same Follow up #33912
* | | Merge pull request #33913 from kamipo/counter_cacheRyuta Kamizono2018-09-205-29/+43
|\ \ \ | | | | | | | | | | | | Don't update counter cache unless the record is actually saved
| * | | Don't update counter cache unless the record is actually savedRyuta Kamizono2018-09-195-29/+43
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a 4th attempt to make counter cache transactional completely. Past attempts: #9236, #14849, #23357. All existing counter cache issues (increment/decrement twice, lost increment) are caused due to updating counter cache on the outside of the record saving transaction by assigning belongs_to record, even though assigning that doesn't cause the record saving. We have the `@_after_replace_counter_called` guard condition to mitigate double increment/decrement issues, but we can't completely prevent that inconsistency as long as updating counter cache on the outside of the transaction, since saving the record is not always happened after that. We already have handling counter cache after create/update/destroy, https://github.com/rails/rails/blob/1b90f614b1b3d06b7f02a8b9ea6cd84f15d58643/activerecord/lib/active_record/counter_cache.rb#L162-L189 https://github.com/rails/rails/blob/1b90f614b1b3d06b7f02a8b9ea6cd84f15d58643/activerecord/lib/active_record/associations/builder/belongs_to.rb#L33-L59 so just removing assigning logic on the belongs_to association makes counter cache transactional completely. Closes #14849. Closes #23357. Closes #31493. Closes #31494. Closes #32372. Closes #33113. Closes #33117 Closes #33129. Closes #33458.
* | | | Merge pull request #33912 from gmcgibbon/ar_result_to_hash_deprecateRafael França2018-09-194-5/+27
|\ \ \ \ | | | | | | | | | | Deprecate ActiveRecord::Result#to_hash in favor of #to_a
| * | | | Deprecate ActiveRecord::Result#to_hash in favor of #to_aKevin Cheng2018-09-184-5/+27
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | method returns an array of hashes, not a hash e.g. Hash.try_convert(result) calls #to_hash and raises a TypeError [Gannon McGibbon + Kevin Cheng]
* | | | Fix env name for master keyyuuji.yaginuma2018-09-203-3/+3
| | | | | | | | | | | | | | | | When using environment specific credentials, `RAILS_MASTER_KEY` is not used.
* | | | Merge pull request #32932 from y-yagi/fixes_32920Yuji Yaginuma2018-09-202-1/+16
|\ \ \ \ | | | | | | | | | | Add CSP nonce to `style-src` directive
| * | | | Add CSP nonce to `style-src` directiveyuuji.yaginuma2018-05-192-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For nonce, only `script-src` and` style-src` are meaningful in the definition of Content Security Policy Level 2. https://www.w3.org/TR/CSP2/#script-src-nonce-usage https://www.w3.org/TR/CSP2/#style-src-nonce-usage Therefore, I think that customization function not needs and it is enough to enable both directives inside the framework. Fixes #32920
* | | | | Support environment specific credentials file. (#33521)Wojciech Wnętrzak2018-09-197-29/+163
| |_|_|/ |/| | | | | | | | | | | | | | | | | | | For `production` environment look first for `config/credentials/production.yml.enc` file that can be decrypted by `ENV["RAILS_MASTER_KEY"]` or `config/credentials/production.key` master key. Edit given environment credentials file by command `rails credentials:edit --environment production`. Default behavior can be overwritten by setting `config.credentials.content_path` and `config.credentials.key_path`.
* | | | Don't return the same object when using find with an empty arrayRafael Mendonça França2018-09-192-2/+5
| |_|/ |/| | | | | | | | | | | | | | When you pass an empty array to find we know we shoudl return an empty array but it is surprising that we are returning the original empty array instead of a new one.
* | | Merge pull request #33897 from bogdanvlviv/follow-up-33751Rafael França2018-09-184-12/+24
|\ \ \ | | | | | | | | Follow up #33751
| * | | `retry_job` should publish `enqueue_retry.active_job` notificationbogdanvlviv2018-09-163-12/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also this commit removes `:wait` from payload of `retry_stopped.active_job`. Related to https://github.com/rails/rails/pull/33751#discussion_r214140008 Follow up #33751 /cc @kaspth, @rafaelfranca
| * | | Payload of `enqueue_retry.active_job` includes `:wait`bogdanvlviv2018-09-161-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Add mention about it to the "Active Support Instrumentation" guide Related to https://github.com/rails/rails/pull/33751#discussion_r214745153 Follow up #33751
* | | | Avoid the same `foreign_key` and `counter_cache` associations on `SillyReply`Ryuta Kamizono2018-09-193-7/+7
| |_|/ |/| | | | | | | | | | | | | | | | | | | | | | | `topic` and `reply` belongs_to associations on `SillyReply` are defined with the same `foreign_key` (`parent_id`) and `counter_cache` (`replies_count`) columns. This would cause unintentional side-effect (e.g. saving `SillyReply` object would cause double increment `replies_count`), so it is better to avoid that side-effect.
* | | Merge pull request #33909 from andrewr224/patch-1Matthew Draper2018-09-181-1/+1
|\ \ \ | | | | | | | | Fix a typo in AR Query Interface [ci skip]
| * | | Fix a typo in AR Query Interface [ci skip]Andrew2018-09-181-1/+1
|/ / /
* | | Merge pull request #33902 from bogdanvlviv/related-to-31727Ryuta Kamizono2018-09-171-1/+1
|\ \ \ | | | | | | | | Fix deprecation warning of `ActiveRecord::Migrator.migrations_path=`
| * | | Fix deprecation warning of `ActiveRecord::Migrator.migrations_path=`bogdanvlviv2018-09-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `ActiveRecord::Migrator.migrations_path=` was deprecated in #31727. This commit fixes: - `ActiveRecord::Migrator.migrations_path=` is deprecated, but not `ActiveRecord::Migrator.migrations_paths=` - Adds missing space The warning including this commit: ``` DEPRECATION WARNING: `ActiveRecord::Migrator.migrations_path=` is now deprecated and will be removed in Rails 6.0. You can set the `migrations_paths` on the `connection` instead through the `database.yml`. ``` Since it was deprecated in Rails 5.2 we should backport it to the `5-2-stable` branch. Related to #31727
* | | | Remove meaningless `ActiveRecord::MigrationContext.new(old_path)` in ensure ↵Ryuta Kamizono2018-09-172-16/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | block `ActiveRecord::MigrationContext.new` just create an instance, doesn't have any side-effect.
* | | | Merge pull request #33898 from tkoyama1988/form_helpers_readableRyuta Kamizono2018-09-171-2/+2
|\ \ \ \ | | | | | | | | | | Improve readability in form helpers guide [ci skip]
| * | | | Improve readability in form helpers guide [ci skip]tkoyama19882018-09-171-2/+2
| | |/ / | |/| |
* | | | Merge pull request #33901 from ↵Ryuta Kamizono2018-09-171-1/+1
|\ \ \ \ | |_|/ / |/| | | | | | | | | | | bogdanvlviv/fix-output-when-run-aj-integration-tests Print correct rake command on running AJ integration tests
| * | | Print correct rake command on running AJ integration testsbogdanvlviv2018-09-171-1/+1
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently when executing `bundle exec rake test:integration` under `activejob/` derectory, it prints helpful info like: ``` (snip) *** rake aj:integration:async *** (snip) *** rake aj:integration:delayed_job *** (snip) ``` but there is no defined `:aj` scope in `activejob/Rakefile`, so I think output should be like: ``` (snip) *** rake test:integration:async *** (snip) *** rake test:integration:delayed_job *** (snip) ``` By the way `rake test:integration` doesn't work if execute it without prepending `bundle exec` to that command. It is probably what we should fix too.
* | | Merge pull request #33899 from bogdanvlviv/follow-up-33405George Claghorn2018-09-161-0/+4
|\ \ \ | | | | | | | | Raise `ActiveRecord::InvalidForeignKey` in `before_destroy` for a blob if attachments exist
| * | | Raise `ActiveRecord::InvalidForeignKey` in `before_destroy` for a blob if ↵bogdanvlviv2018-09-161-0/+4
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | attachments exist The issue #32584 was fixed in #33405 by adding foreign key constraint to the `active_storage_attachments` table for blobs. This commit implements fix on app-level in order to ensure that users can't delete a blob with attachments even if they don't have the foreign key constraint. See a related discussion in the Campfire: https://3.basecamp.com/3076981/buckets/24956/chats/12416418@1236718899 Note that, we should backport it to `5-2-stable` too. Related to #33405
* | | Merge pull request #33188 from larskanis/pg-1.1Yuji Yaginuma2018-09-172-2/+16
|\ \ \ | |/ / |/| | PostgreSQL: prepare for pg-1.1
| * | Return empty array when casting malformed array stringsLars Kanis2018-06-231-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | Parsing of malformed array strings without raising an error is deprecated in pg-1.1. It's therefore necessary to catch parser errors starting with pg-2.0. See also pg commit: https://bitbucket.org/ged/ruby-pg/commits/1b081326b346368e70c9c03ee7080e28d6b3a3dc
| * | PostgreSQL: Prepare for pg-1.1.0Lars Kanis2018-05-271-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Version 1.1.0 deprecates exec and async_exec with a params array due to distinct semantics between calls with and without params array. Instead exec_params or async_exec_params shall be used. Moreover in pg-1.1.0 exec_* and prepare methods are aliases for async_exec_* and async_prepare. async_* methods don't need to be called explicit - they are the default now, when calling exec_* and prepare. For pg versions before 1.1, keep using async_exec.
* | | Merge pull request #33895 from ↵Ryuta Kamizono2018-09-162-1/+9
|\ \ \ | | | | | | | | | | | | | | | | faucct/bugfix/preload_multiple_instances_of_same_record ActiveRecord::Associations::Preloader should preload all instances of the same record
| * | | ActiveRecord::Associations::Preloader should preload all instances of the ↵Nikita Sokolov2018-09-162-1/+9
| | | | | | | | | | | | | | | | same record
* | | | Merge pull request #33893 from y-yagi/fix-av-ujs-build-chromedriverYuji Yaginuma2018-09-162-2/+2
|\ \ \ \ | | | | | | | | | | Fix av-ujs build
| * | | | Load `chromedriver-helper.rb`yuuji.yaginuma2018-09-161-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The bin shim provides by `chromedriver-helper` gem has renamed to `chromedriver-helper` since 2.0. https://github.com/flavorjones/chromedriver-helper/pull/58 Since bin of new name is set to driver path in `lib/chromedriver-helper.rb`, need to load it.
| * | | | Bump `chromedriver-helper` to 2.0yuuji.yaginuma2018-09-161-1/+1
| | | | |
* | | | | Use table name qualified column name for update countersRyuta Kamizono2018-09-162-9/+15
|/ / / / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MySQL supports JOINs to UPDATE, so if column name isn't qualified by table name, it would cause an ambiguous error: ``` Mysql2::Error: Column 'integer' in field list is ambiguous: UPDATE `pets` INNER JOIN `toys` ON `toys`.`pet_id` = `pets`.`pet_id` SET `integer` = COALESCE(`integer`, 0) + 1 WHERE `toys`.`name` = ? ```
* | | | Extract `{update,delete}_all_test.rb` from `persistence_test.rb` and ↵Ryuta Kamizono2018-09-164-335/+347
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `relations_test.rb` `persistence_test.rb` and `relations_test.rb` have too many lines, so I'd like to extract relation around tests to dedicated files before newly test added.
* | | | Unlock pg versonyuuji.yaginuma2018-09-152-5/+5
| | | | | | | | | | | | | | | | | | | | Get a warning about `async_exec`, but it seems that build has passed through the fix of https://bitbucket.org/ged/ruby-pg/commits/be48d118eeedbf6b6a1f0aa14749ab97fc22065c.
* | | | Bump marcel for significant gem size reductionGeorge Claghorn2018-09-141-1/+1
| | | |
* | | | Merge pull request #33878 from kamipo/fallback_to_unprepared_statementRyuta Kamizono2018-09-155-7/+19
|\ \ \ \ | | | | | | | | | | Fallback to unprepared statement only when bind params limit is exceeded
| * | | | Fallback to unprepared statement only when bind params limit is exceededRyuta Kamizono2018-09-145-7/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a follow up and/or an alternative of #33844. Unlike #33844, this would attempt to construct unprepared statement only when bind params limit (mysql2 65535, pg 65535, sqlite3 249999) is exceeded. I only defined 65535 as the limit, not defined 249999 for sqlite3, since it is an edge case, I'm not excited to add less worth extra code.