Commit Graph

87423 Commits

Author SHA1 Message Date
a5-stable
0924095748 allow rewhere to pass nil and return unscope(:where) 2023-05-04 20:31:19 +09:00
Yasuo Honda
912096d4ce
Merge pull request #48081 from shivamsinghchahar/fix-flaky-test-in-ar-token-for
Fix flaky test in AR - token_for_test
2023-04-29 07:21:28 +09:00
Yasuo Honda
2a7cd759be
Merge pull request #48085 from wpank84/patch-1
Update migration examples to showcase database-agnostic raw SQL execution
2023-04-29 07:14:13 +09:00
wpankonien
11efa0445d Update migration example to showcase database-agnostic raw SQL execution 2023-04-28 10:04:13 -05:00
Shivam Chahar
e0ad2e7962 Fix flaky test in AR - token for
pass time arg to @user.touch
2023-04-28 16:40:00 +05:30
Yasuo Honda
cc359c077f
Merge pull request #48019 from agrobbin/postgresql-exclusion-constraints-guides
Add a section on exclusion constraints to the AR PostgreSQL guide
2023-04-28 08:48:09 +09:00
John Hawthorn
9eab88a557
Merge pull request #48084 from aharpole/trilogy-collation-compatibility
In older migrations, allow column collation to be explicitly specified
2023-04-27 12:50:26 -07:00
Aaron Harpole
ac63587cb7 In older migrations, allow column collation to be explicitly specified 2023-04-27 12:21:00 -07:00
Carlos Antonio da Silva
f457544f44 Use the skip forgery protection helper in Active Storage guide
The helper method is essentially a wrapper around skipping the callback,
and it simplifies the doc example.

[ci skip]
2023-04-27 13:58:53 -03:00
Jean Boussier
d5ff2bf222
Merge pull request #48067 from shouichi/document-flash-delete
document AD::FlashHash#delete [skip ci]
2023-04-27 17:04:05 +02:00
Jean Boussier
ce032556c8
Merge pull request #48018 from fatkodima/insert_all-out-of-order-indexes
Allow `insert_all`/`upsert_all` to use indexes with columns not in the same order as in `:unique_by`
2023-04-27 16:58:57 +02:00
fatkodima
45bff1623e Allow insert_all/upsert_all to use indexes with columns not in the same order as in :unique_by 2023-04-27 17:55:41 +03:00
Jean Boussier
976c48779e
Merge pull request #47767 from joshuay03/fix-updated-at-not-updating-in-before-update
Fix #45389 | `updated_at` not updating in `before_update` callback
2023-04-27 16:14:56 +02:00
Jean Boussier
bb4cc27003
Merge pull request #47670 from john-h-k/add-relation-intersect
Add `intersects?` to `Relation`
2023-04-27 16:12:21 +02:00
John Kelly
c837ae624b Add intersects? to Relation
Ruby 3.1 added `intersects?` which is equivalent to `(a & b).any?`. Rubocop added a corresponding cop, `Style/ArrayIntersect`, which transforms the old style to use `intersect?`. Unfortunately as `intersects?` is not delegated on `CollectionProxy`, this leads to false positives that need to be disabled for no good reason other than the fact the method isn't delegated.

This PR add delegation of `intersects?` to `Relation` which fixes this.
2023-04-27 16:09:34 +02:00
Alex Robbin
2d8c3495c3
add a section on exclusion constraints to the AR PostgreSQL guide 2023-04-27 08:18:04 -04:00
Jean Boussier
eac3208b80
Merge pull request #48071 from shivamsinghchahar/add-tests-for-aj-to-verify-queue-name-passed-as-symbols
Add tests for AJ to verify queue name passed as symbol
2023-04-27 12:25:28 +02:00
Petrik de Heus
a933125732
Merge pull request #47987 from p8/guides/unlink-asset-pipeline-libs
Unlink headings for alternative libs in assets guide [ci-skip]
2023-04-27 07:23:29 +02:00
Shouichi Kamiya
7b64a759e1 document AD::FlashHash#delete [skip ci]
Co-authored-by: Seonggi Yang <seonggi.yang@gmail.com>
Co-authored-by: Ryohei UEDA <ueda@anipos.co.jp>
Co-authored-by: oljfte <oljfte@gmail.com>
2023-04-27 13:26:35 +09:00
Yasuo Honda
53df1e140d
Merge pull request #47671 from alpaca-tc/references_with_deferrable_foreign_key
deferrable foreign key can be passed to references
2023-04-27 11:16:38 +09:00
alpaca-tc
ec0a2a9d98 The deferrable foreign key can be passed to t.references.
Fixed a bug in which deferrable foreign_key was ignored when passed to `t.references`.
2023-04-27 10:43:58 +09:00
Yasuo Honda
83d9e4422b
Merge pull request #48070 from shivamsinghchahar/remove-noise-from-am-callbacks-test
Remove noise from actionmailer callbacks test
2023-04-27 08:52:29 +09:00
Yasuo Honda
992d689ae6
Merge pull request #47659 from alpaca-tc/add_foreign_key_deferrable_must_be_false_or_symbol
Deprecate `deferrable: true` option of `add_foreign_key`
2023-04-27 08:45:51 +09:00
Shivam Chahar
88f9bc1237 Remove noise from actionmailer callbacks test 2023-04-26 21:38:54 +05:30
Shivam Chahar
17d1b83b07 Add tests for AJ to verify queue name passed as symbol. Ref: #48034 2023-04-26 21:37:00 +05:30
alpaca-tc
896d35910a Deprecate deferrable: true option of add_foreign_key.
`deferrable: true` is deprecated in favor of `deferrable: :immediate`, and
will be removed in Rails 7.2.

Because `deferrable: true` and `deferrable: :deferred` are hard to understand.
Both true and :deferred are truthy values.
This behavior is the same as the deferrable option of the add_unique_key method, added in #46192.

*Hiroyuki Ishii*
2023-04-26 21:48:17 +09:00
Jean Boussier
5940955ead
Merge pull request #48043 from joshuay03/always-raise-on-nil-cache-key
Consistently raise an `ArgumentError` if the `ActiveSupport::Cache` key is blank
2023-04-26 14:39:27 +02:00
Joshua Young
2b88e78067 Consistently raise an ArgumentError if the ActiveSupport::Cache key is blank 2023-04-26 22:14:31 +10:00
Jean Boussier
663df3aa09
Merge pull request #48069 from Shopify/ar-exec-query-flush-cache
Make Adapter#exec_query clear the query cache
2023-04-26 13:51:50 +02:00
Jean Boussier
3a32921a0a Make Adapter#exec_query clear the query cache
It's public API and we can't assume whether the query is read only
so we should clear the cache.

To perform read only queries, `select` and `select_all` can be used.
2023-04-26 12:59:51 +02:00
Jean Boussier
9b4fff264e
Merge pull request #48068 from Shopify/ar-materialize-transactions
Rename `uses_transactions` to `materialize_transactions`
2023-04-26 12:52:27 +02:00
Jean Boussier
dfa6af68f6 Rename uses_transactions to materialize_transactions
It's hard to understand what `use_transactions` does.
2023-04-26 12:35:50 +02:00
Jean Boussier
073d90c67d
Merge pull request #47735 from nirebu/nirebu/stop-root-string-allocation-in-helper
Do not allocate the first character when checking for relative paths
2023-04-26 12:08:01 +02:00
Jean Boussier
22698947db
Merge pull request #47725 from pawlik/possible-bug-in-activestorage-with-rack-test-uploaded-file
Using Rack::Test::UploadedFile.new with  `StringIO` causes an exception
2023-04-26 12:07:26 +02:00
Grzegorz Pawlik
81ae40b339 Fix Rack::Test::UploadedFile.new to work with StringIO
Instantiating Rack::Test::UplaodedFile with StringIO
no longer causes an exception.
2023-04-26 09:31:45 +00:00
Jean Boussier
5a51610c33
Merge pull request #48039 from ghiculescu/ar-encryption-default-proc
Fix `Marshal.dump` on records that use AR Encryption
2023-04-26 09:04:36 +02:00
Jean Boussier
bad9aa16ea
Merge pull request #48034 from shivamsinghchahar/allow-symbols-as-queue-name-in-activejob-assertions
Allow symbols as queue names in activejob test assertions
2023-04-25 21:30:17 +02:00
Jean Boussier
6ac6b0be9e
Merge pull request #48063 from miharekar/fix-nested-in-order-of
Only flatten first level to preserve nested
2023-04-25 21:27:37 +02:00
Rafael Mendonça França
3a1662f714
Merge pull request #46864 from palkan/feat/arel-function-tables
Support function table names in Arel Table
2023-04-25 14:31:16 -04:00
Rafael Mendonça França
fb4881270b
Merge PR #46843 2023-04-25 18:27:08 +00:00
Rafael Mendonça França
15a7b1ada5
Copy edits on the commit to avoid exposing this class in public API 2023-04-25 18:26:27 +00:00
Miha Rekar
ffa27f314a
Only flatten first level to preserve nested 2023-04-25 16:56:09 +02:00
Jean Boussier
2fa766d9bc
Merge pull request #48061 from Shopify/ar-execute-clear-cache
Active Record: clear query cache automatically when calling `#execute`
2023-04-25 16:46:10 +02:00
Jean Boussier
fe6876415d Get rid of AbstractMysqlAdapter#query
It is now unused.
2023-04-25 16:18:31 +02:00
Jean Boussier
e7baa9798b
Merge pull request #48062 from Shopify/trilogy-disconnect-tests
TrilogyAdapter: implement AdapterConnectionTest primitives
2023-04-25 16:02:49 +02:00
Jean Boussier
63c0d6b31b Active Record: clear query cache automatically when calling #execute
Also refactor #execute to be defined in AbstractAdapter.
2023-04-25 15:55:10 +02:00
Jean Boussier
af97f7e564 TrilogyAdapter: implement AdapterConnectionTest primitives
The tests were skipped.
2023-04-25 15:26:55 +02:00
Jean Boussier
cd100e5338
Merge pull request #48053 from fatkodima/fix-find_or_create_by-transactions
Fix `find_or_create_by`/`find_or_create_by!` when used within concurrent transactions
2023-04-25 11:58:25 +02:00
fatkodima
7130e3cfc4 Fix find_or_create_by/find_or_create_by! when used within concurrent transactions 2023-04-25 12:09:26 +03:00
Jean Boussier
611dac6305
Merge pull request #48054 from Shopify/cleanup-execute
Refactor Mysql2Adapter and TrilogyAdapter
2023-04-25 09:50:24 +02:00