activerecord 8.1.3.1 → 8.1.4
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +617 -0
- data/lib/active_record/associations/association.rb +34 -16
- data/lib/active_record/associations/association_scope.rb +1 -1
- data/lib/active_record/associations/belongs_to_association.rb +2 -2
- data/lib/active_record/associations/builder/belongs_to.rb +19 -4
- data/lib/active_record/associations/collection_association.rb +6 -2
- data/lib/active_record/associations/collection_proxy.rb +4 -0
- data/lib/active_record/associations/foreign_association.rb +3 -1
- data/lib/active_record/associations/has_one_association.rb +1 -0
- data/lib/active_record/associations/join_dependency.rb +1 -2
- data/lib/active_record/associations/preloader/association.rb +1 -1
- data/lib/active_record/attribute_methods/serialization.rb +2 -2
- data/lib/active_record/attribute_methods.rb +6 -4
- data/lib/active_record/callbacks.rb +1 -2
- data/lib/active_record/coders/column_serializer.rb +1 -1
- data/lib/active_record/coders/json.rb +7 -6
- data/lib/active_record/coders/yaml_column.rb +2 -2
- data/lib/active_record/connection_adapters/abstract/connection_pool/reaper.rb +17 -0
- data/lib/active_record/connection_adapters/abstract/connection_pool.rb +32 -20
- data/lib/active_record/connection_adapters/abstract/database_statements.rb +14 -2
- data/lib/active_record/connection_adapters/abstract/schema_statements.rb +2 -2
- data/lib/active_record/connection_adapters/abstract_adapter.rb +12 -0
- data/lib/active_record/connection_adapters/abstract_mysql_adapter.rb +79 -23
- data/lib/active_record/connection_adapters/column.rb +2 -5
- data/lib/active_record/connection_adapters/mysql/schema_statements.rb +7 -21
- data/lib/active_record/connection_adapters/postgresql/database_statements.rb +3 -16
- data/lib/active_record/connection_adapters/postgresql/oid/range.rb +46 -3
- data/lib/active_record/connection_adapters/postgresql/referential_integrity.rb +1 -1
- data/lib/active_record/connection_adapters/postgresql/schema_dumper.rb +1 -1
- data/lib/active_record/connection_adapters/postgresql/schema_statements.rb +17 -5
- data/lib/active_record/connection_adapters/schema_cache.rb +2 -2
- data/lib/active_record/connection_adapters/sqlite3/schema_statements.rb +2 -2
- data/lib/active_record/connection_adapters/sqlite3_adapter.rb +4 -2
- data/lib/active_record/connection_adapters/trilogy/database_statements.rb +4 -0
- data/lib/active_record/connection_adapters/trilogy_adapter.rb +14 -0
- data/lib/active_record/counter_cache.rb +8 -6
- data/lib/active_record/database_configurations/hash_config.rb +9 -2
- data/lib/active_record/database_configurations/url_config.rb +2 -0
- data/lib/active_record/disable_joins_association_relation.rb +5 -1
- data/lib/active_record/encryption/encrypted_fixtures.rb +12 -7
- data/lib/active_record/filter_attribute_handler.rb +6 -3
- data/lib/active_record/gem_version.rb +2 -2
- data/lib/active_record/inheritance.rb +8 -3
- data/lib/active_record/log_subscriber.rb +28 -16
- data/lib/active_record/message_pack.rb +13 -0
- data/lib/active_record/migration/command_recorder.rb +12 -2
- data/lib/active_record/model_schema.rb +2 -2
- data/lib/active_record/nested_attributes.rb +8 -6
- data/lib/active_record/persistence.rb +1 -0
- data/lib/active_record/querying.rb +13 -1
- data/lib/active_record/reflection.rb +1 -1
- data/lib/active_record/relation/calculations.rb +8 -3
- data/lib/active_record/relation/finder_methods.rb +34 -20
- data/lib/active_record/relation/merger.rb +4 -2
- data/lib/active_record/relation/predicate_builder.rb +1 -1
- data/lib/active_record/relation/query_methods.rb +63 -13
- data/lib/active_record/relation.rb +20 -12
- data/lib/active_record/schema.rb +1 -1
- data/lib/active_record/schema_dumper.rb +1 -1
- data/lib/active_record/signed_id.rb +1 -1
- data/lib/active_record/statement_cache.rb +1 -1
- data/lib/active_record/store.rb +4 -2
- data/lib/active_record/tasks/abstract_tasks.rb +8 -1
- data/lib/active_record/tasks/mysql_database_tasks.rb +1 -16
- data/lib/active_record/test_databases.rb +4 -0
- data/lib/active_record/test_fixtures.rb +13 -4
- data/lib/active_record/transactions.rb +19 -16
- data/lib/active_record/type_caster/connection.rb +1 -1
- data/lib/active_record.rb +1 -1
- data/lib/arel/visitors/to_sql.rb +1 -1
- metadata +9 -9
|
@@ -266,7 +266,7 @@ module ActiveRecord
|
|
|
266
266
|
end
|
|
267
267
|
|
|
268
268
|
def before_commit(*args, &block) # :nodoc:
|
|
269
|
-
set_options_for_callbacks!(args)
|
|
269
|
+
set_options_for_callbacks!(:before, args)
|
|
270
270
|
set_callback(:before_commit, :before, *args, &block)
|
|
271
271
|
end
|
|
272
272
|
|
|
@@ -283,31 +283,31 @@ module ActiveRecord
|
|
|
283
283
|
# after_commit :do_bar_baz, on: [:update, :destroy]
|
|
284
284
|
#
|
|
285
285
|
def after_commit(*args, &block)
|
|
286
|
-
set_options_for_callbacks!(
|
|
286
|
+
set_options_for_callbacks!(:after, args)
|
|
287
287
|
set_callback(:commit, :after, *args, &block)
|
|
288
288
|
end
|
|
289
289
|
|
|
290
290
|
# Shortcut for <tt>after_commit :hook, on: [ :create, :update ]</tt>.
|
|
291
291
|
def after_save_commit(*args, &block)
|
|
292
|
-
set_options_for_callbacks!(args, on: [ :create, :update ]
|
|
292
|
+
set_options_for_callbacks!(:after, args, on: [ :create, :update ])
|
|
293
293
|
set_callback(:commit, :after, *args, &block)
|
|
294
294
|
end
|
|
295
295
|
|
|
296
296
|
# Shortcut for <tt>after_commit :hook, on: :create</tt>.
|
|
297
297
|
def after_create_commit(*args, &block)
|
|
298
|
-
set_options_for_callbacks!(args, on: :create
|
|
298
|
+
set_options_for_callbacks!(:after, args, on: :create)
|
|
299
299
|
set_callback(:commit, :after, *args, &block)
|
|
300
300
|
end
|
|
301
301
|
|
|
302
302
|
# Shortcut for <tt>after_commit :hook, on: :update</tt>.
|
|
303
303
|
def after_update_commit(*args, &block)
|
|
304
|
-
set_options_for_callbacks!(args, on: :update
|
|
304
|
+
set_options_for_callbacks!(:after, args, on: :update)
|
|
305
305
|
set_callback(:commit, :after, *args, &block)
|
|
306
306
|
end
|
|
307
307
|
|
|
308
308
|
# Shortcut for <tt>after_commit :hook, on: :destroy</tt>.
|
|
309
309
|
def after_destroy_commit(*args, &block)
|
|
310
|
-
set_options_for_callbacks!(args, on: :destroy
|
|
310
|
+
set_options_for_callbacks!(:after, args, on: :destroy)
|
|
311
311
|
set_callback(:commit, :after, *args, &block)
|
|
312
312
|
end
|
|
313
313
|
|
|
@@ -315,7 +315,7 @@ module ActiveRecord
|
|
|
315
315
|
#
|
|
316
316
|
# Please check the documentation of #after_commit for options.
|
|
317
317
|
def after_rollback(*args, &block)
|
|
318
|
-
set_options_for_callbacks!(
|
|
318
|
+
set_options_for_callbacks!(:after, args)
|
|
319
319
|
set_callback(:rollback, :after, *args, &block)
|
|
320
320
|
end
|
|
321
321
|
|
|
@@ -339,16 +339,11 @@ module ActiveRecord
|
|
|
339
339
|
end
|
|
340
340
|
|
|
341
341
|
private
|
|
342
|
-
def
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
{}
|
|
347
|
-
end
|
|
348
|
-
end
|
|
342
|
+
def set_options_for_callbacks!(position, args, enforced_options = {})
|
|
343
|
+
options = args.extract_options!
|
|
344
|
+
enforced_options.merge!(enforced_prepend_option(position, options))
|
|
345
|
+
options.merge!(enforced_options)
|
|
349
346
|
|
|
350
|
-
def set_options_for_callbacks!(args, enforced_options = {})
|
|
351
|
-
options = args.extract_options!.merge!(enforced_options)
|
|
352
347
|
args << options
|
|
353
348
|
|
|
354
349
|
if options[:on]
|
|
@@ -361,6 +356,14 @@ module ActiveRecord
|
|
|
361
356
|
end
|
|
362
357
|
end
|
|
363
358
|
|
|
359
|
+
def enforced_prepend_option(position, options)
|
|
360
|
+
if position == :after && ActiveRecord.run_after_transaction_callbacks_in_order_defined
|
|
361
|
+
{ prepend: !options[:prepend] }
|
|
362
|
+
else
|
|
363
|
+
{}
|
|
364
|
+
end
|
|
365
|
+
end
|
|
366
|
+
|
|
364
367
|
def assert_valid_transaction_action(actions)
|
|
365
368
|
if (actions - ACTIONS).any?
|
|
366
369
|
raise ArgumentError, ":on conditions for after_commit and after_rollback callbacks have to be one of #{ACTIONS}"
|
|
@@ -20,7 +20,7 @@ module ActiveRecord
|
|
|
20
20
|
column = schema_cache.columns_hash(table_name)[attr_name.to_s]
|
|
21
21
|
if column
|
|
22
22
|
# TODO: Remove fetch_cast_type and the need for connection after we release 8.1.
|
|
23
|
-
type = column.fetch_cast_type(
|
|
23
|
+
type = @klass.with_connection { |c| column.fetch_cast_type(c) }
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
26
|
|
data/lib/active_record.rb
CHANGED
|
@@ -123,7 +123,7 @@ module ActiveRecord
|
|
|
123
123
|
end
|
|
124
124
|
end
|
|
125
125
|
|
|
126
|
-
module Coders
|
|
126
|
+
module Coders # :nodoc:
|
|
127
127
|
autoload :ColumnSerializer, "active_record/coders/column_serializer"
|
|
128
128
|
autoload :JSON, "active_record/coders/json"
|
|
129
129
|
autoload :YAMLColumn, "active_record/coders/yaml_column"
|
data/lib/arel/visitors/to_sql.rb
CHANGED
|
@@ -912,7 +912,7 @@ module Arel # :nodoc: all
|
|
|
912
912
|
# on MySQL (even when aliasing the tables), but MySQL allows using JOIN directly in
|
|
913
913
|
# an UPDATE statement, so in the MySQL visitor we redefine this to do that.
|
|
914
914
|
def prepare_update_statement(o)
|
|
915
|
-
if o.key && (has_limit_or_offset_or_orders?(o) || has_join_sources?(o))
|
|
915
|
+
if o.key && (has_limit_or_offset_or_orders?(o) || has_join_sources?(o) || has_group_by_and_having?(o))
|
|
916
916
|
stmt = o.clone
|
|
917
917
|
stmt.limit = nil
|
|
918
918
|
stmt.offset = nil
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: activerecord
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 8.1.
|
|
4
|
+
version: 8.1.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- David Heinemeier Hansson
|
|
@@ -15,28 +15,28 @@ dependencies:
|
|
|
15
15
|
requirements:
|
|
16
16
|
- - '='
|
|
17
17
|
- !ruby/object:Gem::Version
|
|
18
|
-
version: 8.1.
|
|
18
|
+
version: 8.1.4
|
|
19
19
|
type: :runtime
|
|
20
20
|
prerelease: false
|
|
21
21
|
version_requirements: !ruby/object:Gem::Requirement
|
|
22
22
|
requirements:
|
|
23
23
|
- - '='
|
|
24
24
|
- !ruby/object:Gem::Version
|
|
25
|
-
version: 8.1.
|
|
25
|
+
version: 8.1.4
|
|
26
26
|
- !ruby/object:Gem::Dependency
|
|
27
27
|
name: activemodel
|
|
28
28
|
requirement: !ruby/object:Gem::Requirement
|
|
29
29
|
requirements:
|
|
30
30
|
- - '='
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: 8.1.
|
|
32
|
+
version: 8.1.4
|
|
33
33
|
type: :runtime
|
|
34
34
|
prerelease: false
|
|
35
35
|
version_requirements: !ruby/object:Gem::Requirement
|
|
36
36
|
requirements:
|
|
37
37
|
- - '='
|
|
38
38
|
- !ruby/object:Gem::Version
|
|
39
|
-
version: 8.1.
|
|
39
|
+
version: 8.1.4
|
|
40
40
|
- !ruby/object:Gem::Dependency
|
|
41
41
|
name: timeout
|
|
42
42
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -478,10 +478,10 @@ licenses:
|
|
|
478
478
|
- MIT
|
|
479
479
|
metadata:
|
|
480
480
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
|
481
|
-
changelog_uri: https://github.com/rails/rails/blob/v8.1.
|
|
482
|
-
documentation_uri: https://api.rubyonrails.org/v8.1.
|
|
481
|
+
changelog_uri: https://github.com/rails/rails/blob/v8.1.4/activerecord/CHANGELOG.md
|
|
482
|
+
documentation_uri: https://api.rubyonrails.org/v8.1.4/
|
|
483
483
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
|
484
|
-
source_code_uri: https://github.com/rails/rails/tree/v8.1.
|
|
484
|
+
source_code_uri: https://github.com/rails/rails/tree/v8.1.4/activerecord
|
|
485
485
|
rubygems_mfa_required: 'true'
|
|
486
486
|
rdoc_options:
|
|
487
487
|
- "--main"
|
|
@@ -499,7 +499,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
499
499
|
- !ruby/object:Gem::Version
|
|
500
500
|
version: '0'
|
|
501
501
|
requirements: []
|
|
502
|
-
rubygems_version: 4.0.
|
|
502
|
+
rubygems_version: 4.0.20
|
|
503
503
|
specification_version: 4
|
|
504
504
|
summary: Object-relational mapper framework (part of Rails).
|
|
505
505
|
test_files: []
|