Commit Graph

88787 Commits

Author SHA1 Message Date
Ryuta Kamizono
b32c8a04bd
Merge pull request #47865 from bensheldon/enqueue-error-message
Fix Active Job log message to correctly report a job failed to enqueue when the adapter raises an `ActiveJob::EnqueueError`
2023-09-05 12:16:58 +09:00
fatkodima
2933e16528 Fix in-place modification of shared _counter_cache_columns class attribute 2023-09-04 19:32:48 +03:00
fatkodima
72e3a3c9c1 Fix assert_deprecated related warnings in ActiveRecord tests 2023-09-04 16:25:20 +03:00
fatkodima
32f43176bb Fix has_secure_token on: :initialize when column is not selected 2023-09-04 15:55:57 +03:00
Petrik de Heus
42db7f307f
Merge pull request #49126 from tnir/tn-guide-remove-classic-from-engines
Simplify explanation by removing docs for classic mode
2023-09-04 10:31:08 +02:00
Ryuta Kamizono
8271186d01 Merge pull request #48095 from ippachi/triple-dot-range-unscope
Fix unscope not working when where by tripe dot range
2023-09-04 17:16:25 +09:00
Ryuta Kamizono
25379026fc
Merge pull request #49127 from kamipo/lock_globalid
Lock globalid gem version to address broken CI
2023-09-04 16:54:03 +09:00
Ryuta Kamizono
6440efa9ea Lock globalid gem version to address broken CI
Broken CI is due to https://github.com/rails/globalid/pull/163 in
globalid 1.2.0.

https://buildkite.com/rails/rails/builds/99329#018a5f01-a966-4424-9596-0a7f1deeb1ff/1178-1190
2023-09-04 16:40:19 +09:00
Vipul A M
f324203923
Merge pull request #49125 from akhilgkrishnan/remove-webpacker-reference
[skip ci] Remove webpacker guide reference
2023-09-04 12:51:34 +05:30
Ryuta Kamizono
532188cbf4
Merge pull request #45498 from HParker/deprecate-rewhere-on-merge
Deprecate passing `rewhere` to `merge`
2023-09-04 16:03:42 +09:00
Takuya Noguchi
258a908a0a Simplify explanation by removing docs for classic mode
Signed-off-by: Takuya Noguchi <takninnovationresearch@gmail.com>
2023-09-04 06:29:33 +00:00
Ryuta Kamizono
9084a9045f Add original author's credit for #49100 [ci-skip]
Since #41730 is the original work for the enum attribute validation.
2023-09-04 13:46:15 +09:00
Akhil G Krishnan
4631788d0f [skip ci] Remove webpacker guide reference 2023-09-04 09:37:03 +05:30
Guillermo Iguaran
bf9577e40c
Merge pull request #49123 from skipkayhil/hm-followup-49090
Remove $global mistakenly left in test
2023-09-03 17:53:05 -07:00
Akhil G Krishnan
7d80ccb8ce [skip ci] Description added for ActiveRecord::Base.generates_token_for method in 7.1 release note
[skip ci] Added PR reference

[skip ci] review changes updated

[skip ci] review changes updated
2023-09-03 23:26:29 +05:30
Vipul A M
31052d0e51
Merge pull request #49117 from akhilgkrishnan/general-async-release-note
[skip ci] Description added for `Active Record API for general async queries` in 7.1 release note
2023-09-03 22:17:32 +05:30
Hartley McGuire
db1a3537c7
Remove $global mistakenly left in test
This was accidentally left in when this change was [submitted][1] to
main. This was already addressed in the backport commit but this
addresses it for main.

[1]: 57a9e25f8e96eb28f4f3704db4be55bdb88c22f0
2023-09-02 12:27:50 -04:00
Ben Sheldon
b1b7debaa3
Fix Active Job log message to correctly report a job failed to enqueue when the adapter raises an ActiveJob::EnqueueError 2023-09-02 07:52:43 -07:00
Akhil G Krishnan
04e0b4bfc2 [skip ci] Description added for Active Record API for general async queries in 7.1 release note 2023-09-02 14:51:14 +05:30
Rafael Mendonça França
fea9ad3337
Make sure the message format doesn't change
When `use_message_serializer_for_metadata` is false, the message
format should be enveloped in the same way it was in Rails 7.0
to make sure we don't have inconsistent formats.
2023-09-01 23:03:24 +00:00
Rafael Mendonça França
ed873f1389
Merge pull request #49065 from RuhmUndAnsehen/fix-_to_partial_path-model_name
Fix ActiveModel::Conversion._to_partial_path not using a model's model_name.
2023-09-01 16:41:47 -04:00
Rafael Mendonça França
946550b467
Merge pull request #49067 from p8/performance/securerandom-choose
Use SecureRandom.alphanumeric for SecureRandom.base36/base58
2023-09-01 16:40:34 -04:00
Rafael Mendonça França
7459392bf1
Use the released version of trilogy 2023-09-01 20:39:50 +00:00
Rafael Mendonça França
a21c40bb70
Merge pull request #48912 from seanpdoyle/has-secure-token-default-on-initialize
Change `has_secure_token` default to `on: :initialize`
2023-09-01 16:29:57 -04:00
Sean Doyle
e85a3ec624
Change has_secure_token default to on: :initialize
Follow-up to [#47420][]

With the changes made in [#47420][], `has_secure_token` declarations can
be configured to execute in an `after_initialize` callback. This commit
proposed a new Rails 7.1 default: generate all `has_secure_token` values
when their corresponding models are initialized.

To preserve pre-7.1 behavior, applications can set
`config.active_record.generate_secure_token_on = :create`.

By default, generate the value when the model is initialized:

```ruby
class User < ApplicationRecord
  has_secure_token
end

record = User.new
record.token # => "fwZcXX6SkJBJRogzMdciS7wf"
```

With `config.active_record.generate_secure_token_on = :create`, generate
the value when the model is created:

```ruby
 # config/application.rb
config.active_record.generate_secure_token_on = :create

 # app/models/user.rb
class User < ApplicationRecord
  has_secure_token on: :create
end

record = User.new
record.token # => nil
record.save!
record.token # => "fwZcXX6SkJBJRogzMdciS7wf"
```

[#47420]: https://github.com/rails/rails/pull/47420

Co-authored-by: Hartley McGuire <skipkayhil@gmail.com>
2023-09-01 20:17:22 +00:00
Eileen M. Uchitelle
3bc64016af
Merge pull request #49112 from gmcgibbon/cpk_id_docs
Composite Primary Key id method docs
2023-09-01 15:58:54 -04:00
Эдем
7c65a4b83b
Make enums validatable without raising error (#49100)
* Make enums validatable without raising error

* Trigger fail CI

Co-authored-by: Rafael Mendonça França <rafael@rubyonrails.org>
2023-09-01 15:31:12 -04:00
Gannon McGibbon
5ae1c5a812 [skip ci] Document id_value method
Adds documention for ActiveRecord::ModelSchema#id_value as a utility
when using composite primary keys.
2023-09-01 14:15:02 -05:00
Gannon McGibbon
362134b462 [skip ci] Document composite primary key behaviour
Adds documentation to exaplain composite key behaviour in
ActiveRecord::AttributeMethods::PrimaryKey for
methods #id, #id=, #id?, #id_before_type_cast, #id_was, #id_in_database.
2023-09-01 14:14:43 -05:00
Rafael Mendonça França
cdbc9b78cb
Merge pull request #49090 from skipkayhil/hm-change-column-precision-6
Fix change_column not setting precision for sqlite
2023-09-01 14:21:53 -04:00
Jean Boussier
9fd3d03dab
Merge pull request #49105 from Earlopain/ar-normalizes-where
Document `where` support for AR `normalizes`
2023-09-01 19:02:14 +02:00
Hartley McGuire
57a9e25f8e
Fix change_column not setting precision for sqlite
There were a few 6.1 migration compatibility fixes in [previous][1]
[commits][2]. Most importantly, those commits reorganized some of the
compatibility tests to ensure that the tests would run against every
Migration version. To continue the effort of improving test coverage for
Migration compatibility, this commit converts tests for create_table and
change_column setting the correct precision on datetime columns.

While the create_table tests all pass, the change_column test did not
pass for 7.0 versioned Migrations on sqlite. This was due to the sqlite
adapter not using new_column_definition to set the options on the new
column (new_column_definition is where precision: 6 gets set if no
precision is specified). This happens because columns can't be modified
in place in sqlite and instead the whole table must be recreated and the
data copied. Before this commit, change_column would use the options
of the existing column as a base and merge in the exact options (and
type) passed to change_column.

This commit changes the change_column method to replace the existing
column without using the existing options. This ensures that precision:
6 is set consistently across adapters when change_column is used to
create a datetime column.

[1]: c2f838e80c76c9a3407e1e7af1ecbd738511fd72
[2]: 9b07b2d6ca2ee9854cd986da0bf914b9ace9d547
2023-09-01 16:57:19 +00:00
Adrianna Chang
d3981d1840
Merge pull request #49103 from akhilgkrishnan/activemodel-notable-release-note
[skip ci] ActiveModel notable changes added to 7.1 release note
2023-09-01 12:50:10 -04:00
Akhil G Krishnan
369be4a723 [skip ci] ActiveModel notable changes added to 7.1 release note
[skip ci] review changes updated
2023-09-01 22:14:53 +05:30
Adrianna Chang
d51fa84f19
Merge pull request #49109 from Shopify/document-find-with-cpk
[Docs] Document using `FinderMethods.find` on composite primary key models
2023-09-01 12:36:47 -04:00
Jean Boussier
5504c22631
Merge pull request #49111 from Shopify/fix-isolated-descendants-tracker-test
Fix DescendantsTrackerTest when ran in isolation
2023-09-01 18:34:52 +02:00
Rafael Mendonça França
8bc8a9893f
Merge pull request #49107 from akhilgkrishnan/strict-local-release-note
[skip ci] Description added for "Allow templates to set strict locals" in 7.1 release note
2023-09-01 12:31:23 -04:00
Jean Boussier
553b44a044 Fix DescendantsTrackerTest when ran in isolation
Followup: https://github.com/rails/rails/pull/49108

DescendantsTracker need to work whether the `Class#descendants` core
ext is loaded or not. I missed that in the previous PR.
2023-09-01 18:19:40 +02:00
Nikita Vasilevsky
0aa4cc4bbc
[skip ci] Document using FinderMethods.find on composite primary key models 2023-09-01 16:15:41 +00:00
Earlopain
830957e213
Document where support for AR normalizes
Also some other small changelog tweak:
* Add normalize_value_for to the activerecord changelog
* Fix a wrong method reference in the 7.1 release notes
2023-09-01 18:13:23 +02:00
Eileen M. Uchitelle
b1fca67155
Merge pull request #49110 from Shopify/to-key-with-cpk-changelog-entry
Add CHANGELOG entries for `ActiveModel::Conversion#to_key` changes
2023-09-01 12:09:39 -04:00
Nikita Vasilevsky
0df4df4d15
Add CHANGELOG entries for ActiveModel::Conversion#to_key changes
`8a5cf4cf4415ae1cdad7feecfb27149c151b0b10` made changes to `to_key` in order
to support composite identifiers. This commit adds CHANGELOG entries for those.
2023-09-01 15:41:05 +00:00
Jean Boussier
85ea227919
Merge pull request #49106 from Shopify/reconnect-all
Fix `ActiveRecord.disconnect_all!` to not disable reconnect on pools
2023-09-01 17:12:31 +02:00
Jean Boussier
f82f0da89c
Merge pull request #49108 from Shopify/refactor-core-ext-subclasses
Remove useless include in DescendantsTracker
2023-09-01 17:11:32 +02:00
Jean Boussier
9a1d465438 Fix ActiveRecord.disconnect_all! to not disable reconnect on pools
Followup: https://github.com/rails/rails/pull/47856
2023-09-01 16:59:17 +02:00
Jean Boussier
7407fe8a63 Remove useless include in DescendantsTracker
Either we are on a modern Ruby with `Class#subclass`, in which case
`DescendantsTracker#subclass` isn't defined, so we don't need the
filtering module.

Or we're on an old Ruby, and `DescendantsTracker.subclass` already does
the filtering.
2023-09-01 16:52:01 +02:00
Akhil G Krishnan
cd5c61a77b [skip ci] Description added for Allow templates to set strict locals in 7.1 release note 2023-09-01 20:12:47 +05:30
Jean Boussier
e4350f65fa
Merge pull request #49101 from xfifix/fix/sti_class_name
[Fix #48925] fix "class_name" required for STI class
2023-09-01 12:07:31 +02:00
Filinto Romain
14a34c7223 fix class_name STI 2023-09-01 10:55:28 +02:00
Eileen M. Uchitelle
bb52c41dbf
Merge pull request #49099 from eileencodes/fix-id_value-deprecation-warning-and-message
Fix alias_attribute deprecation warning and message
2023-08-31 15:50:54 -04:00