Commit Graph

87366 Commits

Author SHA1 Message Date
Juan Pablo Balarini
fac9218f78 Add a picture_tag helper 2023-04-30 17:44:42 +00: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
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
zzak
04b0aab872
Use FileUtils.mkdir_p for ujs log directory 2023-04-23 18:58:12 +09:00
Xavier Noria
ea7ac1594b
Merge pull request #48030 from rails/config
Raise if setting a config key that is a method name
2023-04-23 10:38:34 +02:00
Xavier Noria
265bfad5fb Raise if setting a config key that is a method name 2023-04-23 09:39:07 +02:00
Petrik de Heus
7b376de9f2
Merge pull request #48026 from alpaca-tc/postgresql-unique-constraints-guides
Add a section on unique constraints to the AR PostgreSQL guide
2023-04-23 09:35:35 +02:00
Petrik de Heus
c396f202b0
Merge pull request #48029 from p8/docs/actionpack-headers
Cleanup Action Pack documentation headers [ci-skip]
2023-04-22 20:46:51 +02:00
Petrik de Heus
077b2c1d24
Merge pull request #48028 from p8/docs/actioncable-headers
Clean up Action Cable documentation headers [ci skip]
2023-04-22 20:46:42 +02:00
Petrik
c4f0c10157 Clean up Action Cable documentation headers [ci skip] 2023-04-22 20:40:55 +02:00
Petrik
48b205989a Cleanup Action Pack documentation headers [ci-skip] 2023-04-22 20:40:39 +02:00
alpaca-tc
5adc11c45d Add a section on unique constraints to the AR PostgreSQL guide 2023-04-22 23:10:16 +09:00
Jean Boussier
8935db5458 TrilogyAdapterTest: use the proper config 2023-04-22 16:04:32 +02:00
Petrik de Heus
f2327e8df1
Merge pull request #48024 from p8/docs/headers-active-model-types
Fix ActiveModel type headings [ci-skip]
2023-04-22 12:09:47 +02:00
Petrik de Heus
0d02e5d4c3
Merge pull request #48022 from p8/docs/fix-header-level
Fix header level for ActiveModel::Naming and DelegatedType
2023-04-22 12:08:52 +02:00
Petrik de Heus
b8b052e8e7
Merge pull request #48023 from p8/docs/headers-active-record
Add more missing headers to Active Record docs [ci-skip]
2023-04-22 12:04:28 +02:00
Petrik
5a3daa626d Fix ActiveModel type headings [ci-skip] 2023-04-22 12:02:41 +02:00
Petrik
2d1ec4bf09 Add more missing headers to Active Record docs [ci-skip] 2023-04-22 11:58:15 +02:00
Petrik de Heus
b72b7c35dd
Merge pull request #48021 from p8/docs/headers-active-model-types
Add some missing headers to Active Model Type docs [ci-skip]
2023-04-22 11:30:15 +02:00
Petrik
17b3e05133 Fix header level for ActiveModel::Naming and DelegatedType
A class should have a h1 instead of a h2.
2023-04-22 11:25:27 +02:00
Petrik
3042111944 Add some missing headers to Active Model Type docs [ci-skip] 2023-04-22 11:22:16 +02:00
Guillermo Iguaran
5beb0621fc
Merge pull request #48012 from fatkodima/mysql-adapter-load-hook
Add load hook for `ActiveRecord::ConnectionAdapters::Mysql2Adapter`
2023-04-21 15:56:16 -07:00
Guillermo Iguaran
161badb541
[ci skip] Merge pull request #48017 from chhhris/patch-1
Update CHANGELOG example related to Improve Password Length Validation for BCrypt Compatibility
2023-04-21 15:54:43 -07:00
Christopher Lake
42a4fcecf2
Update CHANGELOG example
CHANGELOG was not updated with subsequent changes to the PR #47708
2023-04-21 15:35:53 -07:00
eileencodes
58a0a52019
Fix config and copy over trilogy schema
We had a mysql2_specific_schema.rb file but not one for trilogy that was
causing tests to break. I also removed the prepared statements from
trilogy because it is not supported.
2023-04-21 17:33:25 -04:00
eileencodes
14f22758cc
Bump trilogy to fix connection error translation
Until we do a new release we need to run against main on trilogy to get
the latest changes from https://github.com/github/trilogy/pull/69
2023-04-21 17:33:25 -04:00