activerecord 7.1.0.beta1 → 7.1.0.rc2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +85 -4
  3. data/lib/active_record/associations/collection_association.rb +1 -3
  4. data/lib/active_record/associations/collection_proxy.rb +1 -1
  5. data/lib/active_record/associations.rb +110 -110
  6. data/lib/active_record/connection_adapters/abstract/database_statements.rb +20 -1
  7. data/lib/active_record/connection_adapters/abstract/schema_creation.rb +3 -3
  8. data/lib/active_record/connection_adapters/abstract/transaction.rb +12 -9
  9. data/lib/active_record/connection_adapters/abstract_adapter.rb +1 -1
  10. data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +7 -0
  11. data/lib/active_record/connection_adapters/mysql/schema_statements.rb +1 -1
  12. data/lib/active_record/connection_adapters/pool_manager.rb +1 -1
  13. data/lib/active_record/connection_adapters/postgresql/database_statements.rb +0 -16
  14. data/lib/active_record/connection_adapters/postgresql/schema_creation.rb +5 -5
  15. data/lib/active_record/connection_adapters/postgresql/schema_definitions.rb +24 -24
  16. data/lib/active_record/connection_adapters/postgresql/schema_dumper.rb +19 -8
  17. data/lib/active_record/connection_adapters/postgresql/schema_statements.rb +25 -29
  18. data/lib/active_record/connection_adapters/postgresql_adapter.rb +1 -6
  19. data/lib/active_record/connection_adapters/schema_cache.rb +2 -2
  20. data/lib/active_record/connection_adapters/sqlite3/database_statements.rb +4 -4
  21. data/lib/active_record/connection_adapters/sqlite3_adapter.rb +49 -4
  22. data/lib/active_record/core.rb +7 -9
  23. data/lib/active_record/encryption/extended_deterministic_uniqueness_validator.rb +1 -1
  24. data/lib/active_record/errors.rb +19 -0
  25. data/lib/active_record/gem_version.rb +1 -1
  26. data/lib/active_record/migration/command_recorder.rb +8 -8
  27. data/lib/active_record/nested_attributes.rb +0 -5
  28. data/lib/active_record/normalization.rb +2 -1
  29. data/lib/active_record/persistence.rb +1 -1
  30. data/lib/active_record/querying.rb +2 -2
  31. data/lib/active_record/railtie.rb +1 -1
  32. data/lib/active_record/reflection.rb +10 -16
  33. data/lib/active_record/relation/calculations.rb +8 -8
  34. data/lib/active_record/relation/finder_methods.rb +3 -12
  35. data/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb +4 -6
  36. data/lib/active_record/schema_dumper.rb +9 -4
  37. data/lib/active_record/tasks/sqlite_database_tasks.rb +1 -0
  38. metadata +9 -9
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9c0f9a1eb226b8940b447066c71c2faee79bc3f6e96e36acddd10a7108a64643
4
- data.tar.gz: 2be091ed3458d0ae9b2cdd12b71f1212ab3be9154b929cb473e0d21aed91d3d5
3
+ metadata.gz: 105b6eb9b1f55cf060da5abef79eff897bc6cc4ffae4213d00bb60919716de1d
4
+ data.tar.gz: b2001af69a5d854f66b1f3fd5fc3b2b96161e3185c1b0d11bbcfa606a0a8e3cf
5
5
  SHA512:
6
- metadata.gz: c2aaf3118a53a3d80ac95407cbb46c4a929824f1e76645f1d10be2e56b40b5b24a8a8d9085f33d94aaf20c26e7a0ff6b65ded854d7c0eea6643e19d78e006444
7
- data.tar.gz: 49b247c619c3c9056d0cb748dc63aec82990246dcecf0a623598e4cdad792c039eded0a9a8026a5182ec2cab74cef3295eff38ac222318ef3b1a391f8e0460df
6
+ metadata.gz: a65041e41aa694c421cb83cc41969088ec8c08f5d839fe87b7d9b43c91de2b72d3adb7419858e88fe711654d98b06bf9dad4d8bd6375f4370ff5e40e92782ffb
7
+ data.tar.gz: 5b821a9ab05cd006337411118066eaf3e46219d8969a414406919a9725927b95e51d70f79d2723e165db58e93417354a697420c531cc53d435b8dd8405d502b1
data/CHANGELOG.md CHANGED
@@ -1,3 +1,84 @@
1
+ ## Rails 7.1.0.rc2 (October 01, 2023) ##
2
+
3
+ * Remove -shm and -wal SQLite files when `rails db:drop` is run.
4
+
5
+ *Niklas Häusele*
6
+
7
+ * Revert the change to raise an `ArgumentError` when `#accepts_nested_attributes_for` is declared more than once for
8
+ an association in the same class.
9
+
10
+ The reverted behavior broke the case where the `#accepts_nested_attributes_for` was defined in a concern and
11
+ where overridden in the class that included the concern.
12
+
13
+ *Rafael Mendonça França*
14
+
15
+
16
+ ## Rails 7.1.0.rc1 (September 27, 2023) ##
17
+
18
+ * Better naming for unique constraints support.
19
+
20
+ Naming unique keys leads to misunderstanding it's a short-hand of unique indexes.
21
+ Just naming it unique constraints is not misleading.
22
+
23
+ In Rails 7.1.0.beta1 or before:
24
+
25
+ ```ruby
26
+ add_unique_key :sections, [:position], deferrable: :deferred, name: "unique_section_position"
27
+ remove_unique_key :sections, name: "unique_section_position"
28
+ ```
29
+
30
+ Now:
31
+
32
+ ```ruby
33
+ add_unique_constraint :sections, [:position], deferrable: :deferred, name: "unique_section_position"
34
+ remove_unique_constraint :sections, name: "unique_section_position"
35
+ ```
36
+
37
+ *Ryuta Kamizono*
38
+
39
+ * Fix duplicate quoting for check constraint expressions in schema dump when using MySQL
40
+
41
+ A check constraint with an expression, that already contains quotes, lead to an invalid schema
42
+ dump with the mysql2 adapter.
43
+
44
+ Fixes #42424.
45
+
46
+ *Felix Tscheulin*
47
+
48
+ * Performance tune the SQLite3 adapter connection configuration
49
+
50
+ For Rails applications, the Write-Ahead-Log in normal syncing mode with a capped journal size, a healthy shared memory buffer and a shared cache will perform, on average, 2× better.
51
+
52
+ *Stephen Margheim*
53
+
54
+ * Allow SQLite3 `busy_handler` to be configured with simple max number of `retries`
55
+
56
+ Retrying busy connections without delay is a preferred practice for performance-sensitive applications. Add support for a `database.yml` `retries` integer, which is used in a simple `busy_handler` function to retry busy connections without exponential backoff up to the max number of `retries`.
57
+
58
+ *Stephen Margheim*
59
+
60
+ * The SQLite3 adapter now supports `supports_insert_returning?`
61
+
62
+ Implementing the full `supports_insert_returning?` contract means the SQLite3 adapter supports auto-populated columns (#48241) as well as custom primary keys.
63
+
64
+ *Stephen Margheim*
65
+
66
+ * Ensure the SQLite3 adapter handles default functions with the `||` concatenation operator
67
+
68
+ Previously, this default function would produce the static string `"'Ruby ' || 'on ' || 'Rails'"`.
69
+ Now, the adapter will appropriately receive and use `"Ruby on Rails"`.
70
+
71
+ ```ruby
72
+ change_column_default "test_models", "ruby_on_rails", -> { "('Ruby ' || 'on ' || 'Rails')" }
73
+ ```
74
+
75
+ *Stephen Margheim*
76
+
77
+ * Dump PostgreSQL schemas as part of the schema dump.
78
+
79
+ *Lachlan Sylvester*
80
+
81
+
1
82
  ## Rails 7.1.0.beta1 (September 13, 2023) ##
2
83
 
3
84
  * Encryption now supports `support_unencrypted_data` being set per-attribute.
@@ -16,7 +97,7 @@
16
97
 
17
98
  * Add instrumentation for Active Record transactions
18
99
 
19
- Allows subscribing to transaction events for tracking/instrumentation. The event payload contains the connection, as well as timing details.
100
+ Allows subscribing to transaction events for tracking/instrumentation. The event payload contains the connection and the outcome (commit, rollback, restart, incomplete), as well as timing details.
20
101
 
21
102
  ```ruby
22
103
  ActiveSupport::Notifications.subscribe("transaction.active_record") do |event|
@@ -601,7 +682,7 @@
601
682
 
602
683
  # Topic => Topic(id: integer, title: string, author_name: string...)
603
684
 
604
- Topic.where([:title, :author_name] => [["The Alchemist", "Paul Coelho"], ["Harry Potter", "J.K Rowling"]])
685
+ Topic.where([:title, :author_name] => [["The Alchemist", "Paulo Coelho"], ["Harry Potter", "J.K Rowling"]])
605
686
  ```
606
687
 
607
688
  *Paarth Madan*
@@ -852,7 +933,7 @@
852
933
 
853
934
  *Jean Boussier*
854
935
 
855
- * YAML columns use `YAML.safe_dump` is available.
936
+ * YAML columns use `YAML.safe_dump` if available.
856
937
 
857
938
  As of `psych 5.1.0`, `YAML.safe_dump` can now apply the same permitted
858
939
  types restrictions than `YAML.safe_load`.
@@ -1354,7 +1435,7 @@
1354
1435
 
1355
1436
  *Adrianna Chang*
1356
1437
 
1357
- * Add `expires_in` option to `signed_id`.
1438
+ * Add `expires_at` option to `signed_id`.
1358
1439
 
1359
1440
  *Shouichi Kamiya*
1360
1441
 
@@ -64,9 +64,7 @@ module ActiveRecord
64
64
  ids.map! { |id| pk_type.cast(id) }
65
65
 
66
66
  records = if klass.composite_primary_key?
67
- query_records = ids.map { |values_set| klass.where(primary_key.zip(values_set).to_h) }.inject(&:or)
68
-
69
- query_records.index_by do |record|
67
+ klass.where(primary_key => ids).index_by do |record|
70
68
  primary_key.map { |primary_key| record._read_attribute(primary_key) }
71
69
  end
72
70
  else
@@ -361,7 +361,7 @@ module ActiveRecord
361
361
  # end
362
362
  #
363
363
  # person.pets.create!(name: nil)
364
- # # => ActiveRecord::RecordInvalid: Validation failed: Name cant be blank
364
+ # # => ActiveRecord::RecordInvalid: Validation failed: Name can't be blank
365
365
  def create!(attributes = {}, &block)
366
366
  @association.create!(attributes, &block)
367
367
  end