Commit Graph

87396 Commits

Author SHA1 Message Date
Shivam Chahar
17d1b83b07 Add tests for AJ to verify queue name passed as symbol. Ref: #48034 2023-04-26 21:37:00 +05:30
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
Jean Boussier
eb3a17414a TrilogyAdapter: add some missing nodoc and remove a dead method 2023-04-25 09:24:34 +02:00
Jean Boussier
8e39e0def6 Extract Trilogy::DatabaseStatements
To be consistent with other adapters.
2023-04-25 09:24:34 +02:00
Jean Boussier
f902999b47 Make TrilogyAdapter #each_hash and #error_number private
They were never meant to be public.
2023-04-25 09:24:34 +02:00
Jean Boussier
f69bbcbc07 MySQL2 and TrilogyAdapter: stop using #execute as internal API
`#execute` is a public method and using it internaly forces us to expose
private arguments and other dirty things.

Other adapters don't do this, so this bring MySQL in line with others.
2023-04-25 09:24:34 +02:00
Yasuo Honda
e93bd8fde0
Merge pull request #48048 from tiramizoo/pg-1-5-warning
Fix pg 1.5.0 deprecation warning
2023-04-25 16:13:30 +09:00
Xavier Noria
08d66afcb5 Use RDoc markup 2023-04-25 08:42:20 +02:00
Wojciech Wnętrzak
f05de69c17
Fix pg 1.5 deprecation warning
Closes #48046
2023-04-25 08:39:23 +02:00
Xavier Noria
73e57e4dc5 Document query cache invalidation for raw_connection 2023-04-25 08:28:29 +02:00
Yasuo Honda
744b6715a5
Merge pull request #48040 from fatkodima/fix-deprecation-referential_integrity_test
Fix a deprecation in `referential_integrity_test.rb` file
2023-04-24 21:10:49 +09:00
Jean Boussier
77fa5584a3
Merge pull request #48015 from rails/fix-trilogy-builds-retry
Fix trilogy builds
2023-04-24 09:54:35 +02:00
Jean Boussier
5aabcba52b Delete incompatible Trilogy tests
The trilogy test suite was imported directly, but many of
the test can't work as is in Rails test suite because they were
mutating DB state.

Most are redundant anyway, or should be implemented as shared test
that are executed for all adapters.
2023-04-24 09:35:28 +02:00
Petrik de Heus
40f6c12c24
Merge pull request #48044 from p8/docs/fix-headers
Escape namespaces in some doc headers [ci-skip]
2023-04-24 09:25:00 +02:00
Petrik
f89588240f Escape namespaces in some doc headers [ci-skip]
Also move the CSP header from a method to the module.
2023-04-24 09:18:08 +02:00
Vipul A M
2c274bf472
Merge pull request #48042 from pwim/patch-2
Reword to avoid ambiguity [ci-skip]
2023-04-24 07:51:59 +05:30
Paul McMahon
2918927973
Reword to avoid ambiguity [ci-skip]
As written, it wasn't clear if each migration was run in its own transaction, or all migrations are run in a single transaction.
2023-04-24 11:18:00 +09:00
Guillermo Iguaran
3c08d359a4
Merge pull request #48036 from gareth/rfc6265-compliant-domain-all-cookies
Make Rails cookies RFC6265-compliant with domain: :all
2023-04-23 18:51:51 -07:00
Gareth Adams
8f3c6a1005 Make Rails cookies RFC6265-compliant with domain: :all
Rails has incorrectly been adding leading dots to cookie domain values
when the `domain: :all` option is present.

This leading dot was required in cookies based on [RFC 2965][rfc2965]
(October 2000), but [RFC 6265][rfc6265] (April 2011) changed that
behaviour, making a leading dot strictly incorrect. Todays browsers aim
to confirm to RFC6265 with repect to cookies.

The new behaviour is that *any* cookie with an explicitly passed domain
is sent to all matching subdomains[[ref][mdn]]. For a server to indicate
that only the exact origin server should receive the cookie, it should
instead pass *no* domain attribute.

Despite the change in behaviour, browser devtools often display a cookie
domain with a leading dot to indicate that it is valid for subdomains -
this prefixed domain is *not* necessarily the raw value that was passed
in the Set-Cookie header. This explains why it's a common belief among
developers that the leading dot is required.

RFC6265 standard gives UAs an algorithm to handle old-style cookie
domain parameters (they can drop a leading dot if present), so it's
unlikely that this error would ever have had any effect on web browsers.

However, cookies generated this way can't be processed by Ruby's own
CGI::Cookie class:

> CGI::Cookie.new "domain" => ".foo.bar", "name" => "foo"
ArgumentError: invalid domain: ".foo.bar"

Newer versions of the Ruby CGI library accomodate the same fallback
behaviour (dropping the extra dot) but this isn't a justification for it
being the right way to set a cookie.

[mdn]: https://developer.mozilla.org/en-US/docs/Web/HTTP/Cookies#domain_attribute
[rfc2965]: https://www.rfc-editor.org/rfc/rfc2965#section-3.2
[rfc6265]: https://www.rfc-editor.org/rfc/rfc6265#section-4.1.1
2023-04-24 01:38:34 +01:00
Guillermo Iguaran
21d0ef0255
Merge pull request #48031 from zzak/av-ujs-rake-mkdir-log
Use FileUtils.mkdir_p for ujs log directory
2023-04-23 16:31:34 -07:00
fatkodima
b81e98ca44 Fix a deprecation in referential_integrity_test.rb file 2023-04-24 02:11:36 +03:00
Alex Ghiculescu
c363334ddf Fix Marshal.dump on records that use AR Encryption
Fixes https://github.com/rails/rails/issues/48038

I don't think we need to use a proc here - it doesn't seem like there is any performance benefit in doing so. The default is being read from the `columns_hash`, which will already be loaded in memory. And then the `default` method is just reading a scalar value (or returning nil).
2023-04-23 15:49:15 -06:00
Petrik de Heus
c5a91a3137
Merge pull request #48027 from steve-abrams/sabrams-update-postgres-doc
Add section on INCLUDE option to postgres doc [ci-skip]
2023-04-23 21:45:48 +02:00
Steven Abrams
95f4d75112 Add section on INCLUDE option to postgres doc
- Add a section to the ActiveRecord PostgreSQL doc
  describing use of the INCLUDE index option.
- Related to https://github.com/rails/rails/pull/44803
2023-04-23 13:25:49 -06:00
Petrik de Heus
719558c90f
Merge pull request #48033 from p8/docs/active-support-headers
Add missing headers to Active Support docs [ci-skip]
2023-04-23 16:10:01 +02:00
Petrik
ec28de4260 Add missing headers to Active Support docs [ci-skip]
Having a h1 heading will improve SEO and makes things look more consistent.
2023-04-23 16:02:56 +02:00
Shivam Chahar
562846ae0c Allow symbols as queue names in activejob assertions 2023-04-23 18:53:48 +05:30