Commit Graph

88787 Commits

Author SHA1 Message Date
Akhil G Krishnan
59854da1bf
Removed Webpacker files 2023-09-06 17:11:58 +00:00
Rafael Mendonça França
0ee95801f3
Merge pull request #49167 from Uaitt/bump-actions-checkout-version
Bump github actions/checkout to v4
2023-09-06 11:49:01 -04:00
Rafael Mendonça França
b6166e8da2
Merge pull request #49056 from joshuay03/raise-on-duplicate-accepts-nested-attributes-for
[Fix #49055] Raise an `ArgumentError` when `#accepts_nested_attributes_for` is redeclared for an association
2023-09-06 11:47:41 -04:00
Joshua Young
0a54155757
[Fix #49055] Raise an ArgumentError when #accepts_nested_attributes_for is redeclared for an association 2023-09-06 15:27:59 +00:00
Lorenzo Zabot
b5a5c191f2 Bump github actions/checkout to v4 2023-09-06 15:05:32 +02:00
Ryuta Kamizono
5415d3a19a Remove "proc to update web drivers." [ci-skip]
Follow-up to #48847.

This was originally "The webdrivers gem uses this proc to update web
drivers.".
2023-09-06 13:23:14 +09:00
Akhil G Krishnan
7b8eadba02
[skip ci] ActiveSupport deprecate changes added to 7.1 release note (#49119)
* [skip ci] ActiveSupport deprecate changes added to 7.1 release note

* Update guides/source/7_1_release_notes.md

Co-authored-by: Adrianna Chang <adrianna.chang@shopify.com>

---------

Co-authored-by: Rafael Mendonça França <rafael@rubyonrails.org>
Co-authored-by: Adrianna Chang <adrianna.chang@shopify.com>
2023-09-05 16:29:07 -04:00
Rafael Mendonça França
e1cfcb1951
Fix indentation in 7.1 release notes 2023-09-05 20:27:06 +00:00
Rafael Mendonça França
f9e4fb9bed
Merge pull request #49152 from yahonda/bigdecimal_314_or_higher_will_be_installed
Just check the BigDecimal 3.1+ behavior at `NumericalityValidationTest`
2023-09-05 15:59:23 -04:00
Jonathan Hefner
5cca7f9fa7
Merge pull request #49161 from jonathanhefner/remove-unused-fixtures-in-connection_test
Remove unused fixtures in `*ConnectionTest`
2023-09-05 14:29:37 -05:00
Rafael Mendonça França
5bd10ff533
Merge pull request #49118 from akhilgkrishnan/generate-token-for-release-note
[skip ci] Description added for `ActiveRecord::Base.generates_token_for` method in 7.1 release note
2023-09-05 15:21:38 -04:00
Jonathan Hefner
fe87afe022 Remove unused fixtures in *ConnectionTest
These fixtures were added in 9a4e183fe9f81365f7815c391512b3d46622d8c8 to
test the behavior of `connection.truncate`, but then the relevant tests
were extracted to `AdapterTestWithoutTransaction` in
fdac932707fb16b7d074b1d0bc7c255157d72675.
2023-09-05 14:11:29 -05:00
Rafael Mendonça França
43617c4cea
Merge pull request #49157 from adrianna-chang-shopify/ac-contrib-docs-addition
[ci skip] Instruct contributors to use 'ci skip' when submitting docs
2023-09-05 15:07:07 -04:00
Jonathan Hefner
5dfa45bb92
Merge pull request #49159 from jonathanhefner/fix-49143
Load ambient fixtures for `ActiveRecordMessagePackTest`
2023-09-05 13:56:07 -05:00
Jonathan Hefner
69e6bae020 Load ambient fixtures for ActiveRecordMessagePackTest
`ActiveRecordMessagePackTest` does not use any fixtures, but fixtures
that were previously loaded without preserving referential integrity can
affect query results.  For example, if previous tests load `:comments`
fixtures but not `:posts` fixtures, there will be `Comment` records in
the database with `post_id = 1` but no corresponding `Post` record.
Then, when a `Post` is created in `ActiveRecordMessagePackTest`, its
`comments` association will accidentally include those prior `Comment`
records.

This commit loads ambient fixtures for the relevant models in
`ActiveRecordMessagePackTest` to prevent such accidental results.

Fixes #49143.
2023-09-05 13:36:21 -05:00
Eileen M. Uchitelle
20df3820a0
Merge pull request #49154 from Shopify/query-constraints-option-in-associations
Document `query_constraints` option in associations
2023-09-05 14:09:03 -04:00
Eileen M. Uchitelle
7716e32dc9
Merge pull request #49113 from adrianna-chang-shopify/ac-infer-pk-id-composite-associations
Infer `primary_key: :id` on associations with composite primary key models
2023-09-05 14:08:14 -04:00
Adrianna Chang
5f5533e96c
Instruct contributors to use 'ci skip' when submitting doc changes 2023-09-05 14:05:29 -04:00
Rafael Mendonça França
fee7de5455
Merge pull request #49145 from javierav/feature/assets-config
Do not generate configuration for sprockets if propshaft is used
2023-09-05 13:59:19 -04:00
Nikita Vasilevsky
96d3cca6d8
[ci skip] Document query_constraints option in associations 2023-09-05 17:54:16 +00:00
Rafael Mendonça França
3539922111
Merge pull request #49139 from p8/actionmailer/require-previews
Remove internal usage of require_dependency
2023-09-05 13:36:07 -04:00
Adrianna Chang
f8c10e790b
Merge pull request #49096 from abaldwin88/document_class_method_scope_behavior
Document clean chain behavior for ActiveRecord scope
2023-09-05 13:33:02 -04:00
Alex Baldwin
cebac599b8 Document clean chain behavior for ActiveRecord scope 2023-09-05 12:37:13 -04:00
Rafael Mendonça França
e4d47eaecf
Revert "Lock globalid gem version to address broken CI"
This reverts commit 6440efa9ea05cde1f001098aa25bebbb2ea20fbb.
2023-09-05 16:17:49 +00:00
Adrianna Chang
2fdd1ad670
Infer primary_key: :id on associations with composite primary key models
Previously, a composite primary key model would need to specify
either a `primary_key` or `query_constraints` option on its associations.
Without it, a `CompositePrimaryKeyMismatchError` would be raised.

Most of the time, the composite primary key includes the `:id` column,
and associations already expect that `:id` is being used as the
primary key for the association (and have a corresponding foreign_key
column set on the associated model).

Rather than requiring users to define `primary_key: :id` throughout
an application with composite primary key associations, we can infer
that the `:id` column should be used. Users can still override this
behaviour by specifying a `primary_key:` or `query_constraints:` on
the association.

Note that, if the composite primary key for a model does _not_ include
`:id`, Rails won't infer the primary key for any related associations,
and users must still specify `query_constraints` or `primary_key`.

Prior to this change, you'd need to do the following to set up
associations for composite primary key models:

```ruby
class Order
  self.primary_key = [:shop_id, :id]

  has_many :order_agreements, primary_key :id
end

class OrderAgreement
  belongs_to :order, primary_key: :id
end
```

After this change, the `primary_key` option no longer needs to be
specified:

```ruby
class Order
  self.primary_key = [:shop_id, :id]

  has_many :order_agreements
end

class OrderAgreement
  belongs_to :order
end
```
2023-09-05 12:12:57 -04:00
Eileen M. Uchitelle
e32f0b8bb2
Merge pull request #49114 from gmcgibbon/cpk_id_guides
Add composite primary key examples to Rails guides
2023-09-05 11:37:22 -04:00
Gannon McGibbon
847bd59268 [skip ci] Add composite primary key examples to Rails guides
- Action Controller Overview: Add example of how a cpk record can be
  found using a show action.
- Action View Form Helpers: Add example of what a form updating a cpk
  record looks like.
- Action View Helpers: Add examples for url_for and link_to cpk record
  urls.
2023-09-05 10:33:27 -05:00
Eileen M. Uchitelle
ad83a66b70
Merge pull request #49116 from gmcgibbon/where_tuple_docs
Document tuple support in Active Record where clauses
2023-09-05 11:31:54 -04:00
Gannon McGibbon
6d165124cd [skip ci] Document tuple support in Active Record where clauses
Adds documentation to ActiveRecord::QueryMethods#where mentioning tuple
syntax support added in #47729.
2023-09-05 10:15:43 -05:00
Eileen M. Uchitelle
0f8377dd75
Merge pull request #49153 from Shopify/ar_querying_guide_cpk_example
Active Record querying guide: add a composite primary key example for find
2023-09-05 11:07:08 -04:00
Noah Gibbs
351f05579f
Active Record query guide: add a composite primary key example for find 2023-09-05 15:54:14 +01:00
Yasuo Honda
1538959557 Just check the BigDecimal 3.1+ behavior at NumericalityValidationTest
To prepare Ruby 3.4 will ship `bigdecimal` as bundled gem,
`bigdecimal` has been added to Active Support runtime dependency
via https://github.com/rails/rails/pull/49039

It will install BigDecimal version 3.1.4 or higher,
so we just check the BigDecimal 3.1+ behavior at `NumericalityValidationTest`.

Refer to
https://github.com/rails/rails/pull/49039
https://github.com/ruby/bigdecimal/pull/180
https://github.com/ruby/bigdecimal/issues/70
2023-09-05 23:09:41 +09:00
Petrik
6998747947 Remove internal usage of require_dependency
Since 6983a89c726243fb38fe28cff49cba3a5f63ba6f `require_dependency` is
obsolete  since Rails stopped supporting classic mode.
It is only used by engines that need to support classic mode as well.

We can safely remove internal usage of `require_dependency`.

It was only used in the ActionMailer::Preview which is using just
`require` anyway.
2023-09-05 16:05:48 +02:00
Adrianna Chang
6633671e3a
Merge pull request #49150 from Shopify/rails_guides_updates_for_composite_primary_keys
Rails Guides: describe composite primary keys (CPK) for migrations and querying
2023-09-05 09:06:23 -04:00
Noah Gibbs
586c79d8b0
Mention composite primary keys for migrations and querying 2023-09-05 12:34:40 +01:00
Ryuta Kamizono
5fc58c86d2
Merge pull request #49148 from deepakmahakale/release_notes_7_1/minor_code_block_changes
[skip ci] Minor formatting fixes for code blocks
2023-09-05 19:54:04 +09:00
Ryuta Kamizono
1b0ee9f3f6
Merge pull request #49149 from deepakmahakale/release_notes_7_1/merge_rewhere_deprecated
[skip ci] rewhere argument on #merge deprecated
2023-09-05 19:53:04 +09:00
Deepak Mahakale
ba7def2e53 [skip ci] rewhere argument on #merge deprecated 2023-09-05 16:09:05 +05:30
Ryuta Kamizono
cf10924421
Merge pull request #49146 from kamipo/generating_token_only_once
Generate secure token only once regardless of `on: :initialize` or `on: :create`
2023-09-05 19:24:26 +09:00
Jean Boussier
11257c82ee
Merge pull request #49120 from akhilgkrishnan/simple-format-blank-wrapper
Fix: simple_format with blank wrapper_tag option returns plain html tag.
2023-09-05 12:17:49 +02:00
Deepak Mahakale
a16f1907ff [skip ci] Minor formatting fixes for code blocks 2023-09-05 15:40:56 +05:30
Akhil G Krishnan
1677e31240
Fix: simple_format with blank wrapper_tag option returns plain html tag.
By default `simple_format` method returns the text wrapped with `<p>`. But if we explicitly specify
the `wrapper_tag: nil` in the options, it returns the text wrapped with `<></>` tag.

Before:
```ruby
 simple_format("Hello World", {},  { wrapper_tag: nil })
 # <>Hello World</>
```

After:
```ruby
 simple_format("Hello World", {},  { wrapper_tag: nil })
 # <p>Hello World</p>
```

Co-authored-by: Junichi Ito <jit@sonicgarden.jp>
2023-09-05 10:09:40 +00:00
Ryuta Kamizono
a10e7a9dc5 Fix test_generating_token_on_initialize_does_not_affect_reading_from_the_column 2023-09-05 18:31:05 +09:00
Ryuta Kamizono
2a73ef8d3b Fix a test added in #48912 to work on a model with on: :initialize
Since default behavior is still `on: :create`.
2023-09-05 18:25:19 +09:00
Ryuta Kamizono
4f2fa59734 Don't modify existing test model in a test case
It will affect to other tests.
2023-09-05 18:12:33 +09:00
Ryuta Kamizono
2df70ddb96 Generate secure token only once regardless of on: :initialize or on: :create
Follow-up to #47420.

Whereas the original behavior (`on: :create`) is invoked only once
before a record is persisted, the new behavior (`on: :initialize`) is
invoked not only new record but also persisted records.

It should be invoked only once for new record consistently.
2023-09-05 17:43:41 +09:00
Javier Aranda
ea351f0f49
Do not generate configuration for sprockets if propshaft is used 2023-09-05 10:11:45 +02:00
Ryuta Kamizono
2fbb25b771
Merge pull request #49133 from fatkodima/fix-has_secure_token-when-not-selected-column
Fix `has_secure_token on: :initialize` when column is not selected
2023-09-05 15:25:16 +09:00
Ryuta Kamizono
ca374bd9a3
Merge pull request #49136 from fatkodima/fix-counter-caches-var-modification
Fix in-place modification of shared `_counter_cache_columns` class attribute
2023-09-05 15:07:52 +09:00
Ryuta Kamizono
49314abc33
Merge pull request #49134 from fatkodima/fix-ar-tests-warnings
Fix `assert_deprecated` related warnings in ActiveRecord tests
2023-09-05 13:01:26 +09:00