Commit Graph

88047 Commits

Author SHA1 Message Date
Gannon McGibbon
16a5bdc511 Use _read_attribute in ids method
Support calculating IDs for collection proxies
using composite id column values instead of the id reader.
2023-06-26 15:33:30 -05:00
Gannon McGibbon
8a33758e51 Use _read_attribute in [association]_ids writer
Supports id primary key assignment in [association]_ids writer
for composite primary keys.
2023-06-26 15:33:30 -05:00
Gannon McGibbon
e224768d14 Use id instead of number in composite key for Cpk::Book
Use [:author_id, :id] instead of [:author_id, :number] as
the primary key of Cpk::Book.
2023-06-26 15:33:28 -05:00
Guillermo Iguaran
5eccc6a165
Merge pull request #48566 from abaldwin88/fix_active_job_passed_class_defining_permitted
Fix error ActiveJob passed class with `permitted?`
2023-06-23 12:56:54 -07:00
Gannon McGibbon
1ba823d662
Merge pull request #48552 from gmcgibbon/fix_cpk_hmt
Add support for unpersisted CPK has_one/has_many through associations
2023-06-23 14:42:20 -05:00
Eileen M. Uchitelle
ba9c2e57dc
Merge pull request #48567 from eileencodes/add-rake-tests-for-trilogy
Add rake tests for trilogy
2023-06-23 13:15:12 -04:00
eileencodes
80d089b5d2
Add rake tests for trilogy
These were missed in the migration. I also renamed the mysql2 ones to
mysql2 from mysql to match the appropriate namespaces.
2023-06-23 12:32:39 -04:00
Alex Baldwin
719e49485f Fix error ActiveJob passed class with permitted?
Resolves #48561
Co-authored-by: Sampat Badhe <sampatbadhe@gmail.com>
2023-06-23 10:51:46 -04:00
zzak
5899adad4f
Merge pull request #48563 from zzak/unlink-rails-module
🔗 Remove RDoc auto-link from Rails module everywhere
2023-06-23 11:39:19 +09:00
zzak
dd89f600f7
🔗 Remove RDoc auto-link from Rails module everywhere 2023-06-23 10:49:30 +09:00
Guillermo Iguaran
06da26afba
Merge pull request #48556 from skipkayhil/hm-fix-encrypted-config-hash
Fix EncryptedConfiguration not behaving like Hash
2023-06-22 01:16:02 -07:00
Hartley McGuire
8355658a56
Fix EncryptedConfiguration not behaving like Hash
Previously, `EncryptedConfiguration` was [updated][1] to use
`InheritableOptions` so that keys could be called like methods. It was
later [updated again][2] to ensure that it behaved both like a `Hash` and
`OrderedOptions`. In this second change, the `InheritableOptions`
instance was accidentally nested with another `InheritableOptions`
instance.

This continued to mostly work as expected because `InheritableOptions`
will fall back to the inner `InheritableOptions` when the outer one
doesn't have a key. However, any methods that try to treat the outer
`InheritableOptions` like it should know about all of its keys will fail
(for example, `#keys`, `#to_h`, `#to_json`, etc.)

This commit fixes the issue by removing the extraneous outer
`InheritableOptions` instance.

[1]: a6a9fed1719a3cfe47eb1566ae4d6034374fd809
[2]: 80585daf2def5bf94854be69f81e24a16ce14c55
2023-06-21 23:29:33 -04:00
Akira Matsuda
7a033f58ab
✂️ One more occurrence of gem "minitest"
follows up 5bdd132d00c85493cb030e32264f05be49b3644c
2023-06-22 10:19:46 +09:00
Gannon McGibbon
699a3725ad Add support for unpersisted CPK has_one/has_many through associations
Fixes loading of has_one and has_many associations with composite
primary key though associations that have unpersisted owner records.
2023-06-21 17:15:04 -05:00
Guillermo Iguaran
959d4587bd
Merge pull request #48551 from abaldwin88/document_dev_container_cli
Document Dev Container CLI setup in guides
2023-06-21 14:13:09 -07:00
Guillermo Iguaran
860967d804
Merge pull request #48544 from amatsuda/gem_minitest
Get rid of unnecessary `gem "minitest"` calls
2023-06-21 14:08:32 -07:00
Guillermo Iguaran
d9f22a40e2 Revert "Fix a typo in CHANGELOG.md"
This reverts commit e446ef82c8174a4bd6c98f670912bb395b3091d6.

Array#intersect? is the correct name: https://rubyapi.org/3.2/o/array#method-i-intersect-3F
2023-06-21 13:07:08 -07:00
Alex Baldwin
e4002fcc40 Document Dev Container CLI setup in guides 2023-06-21 15:53:27 -04:00
Jonathan Hefner
7786874530 Add missing code fence terminator [ci-skip] 2023-06-21 13:35:21 -05:00
Eileen M. Uchitelle
d268124842
Merge pull request #48539 from gmcgibbon/fix_cpk_nullify
Add support for nullifying composite primary key has_one associations
2023-06-21 14:33:41 -04:00
Akira Matsuda
5bdd132d00
minitest is no longer a stdlib on any of the supported versions of Rubies
CRuby's bundled minitest had been removed in 2.2.0 at
7cda8222ca
2023-06-22 02:03:33 +09:00
Gannon McGibbon
622485ae4b Add support for nullifying CPK has_one associations
Composite primary key records need to conditionally unset multiple
column attributes from the associated record in order to properly
support dependent: nullify.
2023-06-21 11:08:06 -05:00
eileencodes
7dd27be1a2
Silence warnings on require for this test
The schema cache dump throws a warning and is supposed to. But we don't
want to see the warnings in test output, so silence them.
2023-06-21 11:04:33 -04:00
Jean Boussier
e446ef82c8
Fix a typo in CHANGELOG.md
Ref: https://github.com/rails/rails/pull/47670/files#r1236168967

It's `intersects?` not `intersect?`
2023-06-21 09:11:42 +02:00
Guillermo Iguaran
c20f8eb6b6
Merge pull request #48471 from mdh/improve-naming-of-local-secret-generation
Improve naming of local secret generation
2023-06-21 00:04:32 -07:00
Guillermo Iguaran
43660951a4 Test delegation of Relation to Array#intersect? only in Ruby >= 3.1.0 2023-06-20 22:48:44 -07:00
zzak
8725f61cdb
Merge pull request #48526 from ghiculescu/active-job-docs
Update Active Job testing guide
2023-06-21 14:38:31 +09:00
Guillermo Iguaran
119b4b2af1 Fix the name of delegated method for the records to Array#intersect?
The right method name is Array#intersect?

This adds a test case to avoid this mistake in the future.
2023-06-20 22:22:58 -07:00
Rafael Mendonça França
96afb979c6
Merge pull request #48536 from ghiculescu/revert-48534-hm-revert-48527
Disallow `id` as an enum value in Active Record (v2)
2023-06-20 19:17:17 -04:00
Alex Ghiculescu
657600c4d6 Revert "Revert "Merge pull request #48527 from ghiculescu/active-record-enum-id"" 2023-06-21 08:56:13 +10:00
Guillermo Iguaran
6499ccbd09
Merge pull request #48534 from skipkayhil/hm-revert-48527
Revert "Merge pull request #48527 from ghiculescu/active-record-enum-id"
2023-06-20 15:41:12 -07:00
Aaron Patterson
6264c1de76
Merge pull request #48487 from lazaronixon/scope-subqueries
Apply scope to association subqueries
2023-06-20 15:07:29 -07:00
Hartley McGuire
96a86cb630
Revert "Merge pull request #48527 from ghiculescu/active-record-enum-id"
This reverts commit 8b36095881435e996db16604c52737e144b6bff3, reversing
changes made to e05245db878077097d666f7667c0f9057f767583.

Railties tests have been failing since this change. The issue is that
calling `primary_key` as the model is loaded requires either a
connection to the database or a populated schema cache. This becomes an
issue when an app loads models that do not have underlying tables, as
shown in the failing Railties tests.

When eager loading an app using `rails/all`,
`ActionMailbox::InboundEmail` will be loaded whether or not `rails g
action_mailbox:install` has been run. This means the `primary_key` for
`InboundEmail` will not be in the schema cache and a database connection
will be required to boot the app.
2023-06-20 17:44:36 -04:00
Rafael Mendonça França
6c80bcdd20
Merge pull request #48532 from abaldwin88/fix_devcontainer_trilogy_socket
Fix devcontainer trilogy connection for tests
2023-06-20 12:40:41 -04:00
Alex Baldwin
d5b5ce32ae Fix devcontainer trilogy connection for tests
Previously, executing Active Record tests against the trilogy adapter
within a devcontainer would fail with the error message:

```
Trilogy::SyscallError::ENOENT: No such file or directory - trilogy_connect
- unable to connect to /tmp/mysql.sock (ActiveRecord::StatementInvalid)
```
2023-06-20 12:07:01 -04:00
Rafael Mendonça França
0a4d76d3f7
Update devcontainer.json to use Shopify.ruby-lsp extension
rebornix.Ruby is deprecated.
2023-06-20 15:46:16 +00:00
Rafael Mendonça França
330a123382
Move trilogy config closer to mysql2 2023-06-20 15:30:07 +00:00
zzak
c25cc2ead2
Merge pull request #48512 from zzak/fixtures-docs
Update documentation around fixture paths
2023-06-20 16:08:04 +09:00
zzak
9cdc347342
Fixup AR::FixtureSet docs
* Improve the spacing of various paragraphs
* Link to AS::TestCase.fixture_paths= API
* Add a note about needing to require "rails/test_help" to get fixture_paths
* Expanded briefly on YAML default map unordering property
* Improve heading weight consistency
* Unlink several RDoc autolinked things
2023-06-20 15:47:13 +09:00
zzak
3e8d8e67a9
Document ActiveSupport::TestCase.fixture_paths= and getter
These methods are only available when requiring the railties
"rails/test_help" file, which is included by default in the
test_helper.rb for newly generated Rails applications.

Since requiring that file is the only way, and some applications may
have removed it or not used test-unit when generating their application,
I think it's worth calling out explicitly here.
2023-06-20 15:47:12 +09:00
zzak
4a63d94a24
Fix AR::TestFixtures.fixture_paths= docs
This removes the deprecated .fixture_path and .fixture_path= methods
from public documentation, and creates a class method for the getter and
setters.

Interestingly because these methods were always `class_attribute` based,
which RDoc doesn't parse, they weren't technically "public"
documentation.
2023-06-20 15:47:07 +09:00
zzak
2cdb05f7e1
Make ActionMailer::TestCase#read_fixture public
Since this method has been documented in the guides for ages, it's probably safe.

https://guides.rubyonrails.org/testing.html#revenge-of-the-fixtures

TODO: I don't like how these methods are documented on
ActionMailer::TestCase::Behavior, even though the API is meant to be
exposed through ActionMailer::TestCase
2023-06-20 15:44:52 +09:00
Guillermo Iguaran
162c4b47d3
Merge pull request #48523 from flavorjones/flavorjones-update-action-view-and-action-dispatch-to-html5
Update Action View and Action Dispatch to use HTML5 when available
2023-06-19 19:40:22 -07:00
Guillermo Iguaran
8b36095881
Merge pull request #48527 from ghiculescu/active-record-enum-id
Disallow `id` as an enum value in Active Record
2023-06-19 19:36:42 -07:00
Guillermo Iguaran
e05245db87
Merge pull request #48521 from flavorjones/flavorjones-update-rails-guides-to-html5
Update guides generation to use Nokogiri's HTML5 parser
2023-06-19 18:36:15 -07:00
Guillermo Iguaran
52ca1b6345
Merge pull request #48522 from flavorjones/flavorjones-update-action-view-to-html5
Update Action Text to use HTML5 when available
2023-06-19 18:32:39 -07:00
Alex
a22b942fb3 Disallow id as an enum value in Active Record
Fixes https://github.com/rails/rails/issues/48524

The test case in the issue breaks because `value.respond_to?(:id)` returns true [here](51f2e2f80b/activerecord/lib/active_record/relation/predicate_builder.rb (L58)). This effectively adds a default scope to queries where it shouldn't.

There might be a way to fix this in Active Record but I'd be surprised if nothing else breaks from defining `id` instance and class methods. I think it is simpler to not allow it as a value since it really should be treated as a reserved method.
2023-06-20 11:22:30 +10:00
Alex
10bb51a123 Update Active Job testing guide
The testing guide for Active Job currently implies that when you queue a job it will be performed.

This isn't true; by default jobs are enqueued, not performed.

This PR fleshes out the docs a bit to show both examples, and adds a test to confirm the default behaviour.
2023-06-20 09:58:33 +10:00
Gannon McGibbon
51f2e2f80b
Merge pull request #48519 from adrianna-chang-shopify/ac-tweak-fixture-path-deprecations
Fix deprecation warning messages for `ActiveSupport::TestFixtures`
2023-06-19 17:32:13 -05:00
Mike Dalessio
2362f57cd8
Update Action View and Action Dispatch to use HTML5 when available 2023-06-19 16:34:33 -04:00