activerecord 6.1.0 → 6.1.3.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of activerecord might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +200 -15
- data/README.rdoc +1 -1
- data/lib/active_record/aggregations.rb +4 -4
- data/lib/active_record/association_relation.rb +10 -0
- data/lib/active_record/associations.rb +6 -2
- data/lib/active_record/associations/association.rb +7 -7
- data/lib/active_record/associations/association_scope.rb +7 -5
- data/lib/active_record/associations/belongs_to_association.rb +7 -3
- data/lib/active_record/associations/belongs_to_polymorphic_association.rb +7 -2
- data/lib/active_record/associations/builder/association.rb +23 -2
- data/lib/active_record/associations/builder/belongs_to.rb +2 -2
- data/lib/active_record/associations/has_many_association.rb +1 -1
- data/lib/active_record/associations/join_dependency.rb +1 -1
- data/lib/active_record/associations/join_dependency/join_association.rb +8 -7
- data/lib/active_record/attributes.rb +1 -1
- data/lib/active_record/connection_adapters/abstract/connection_pool.rb +4 -4
- data/lib/active_record/connection_adapters/abstract/database_statements.rb +1 -1
- data/lib/active_record/connection_adapters/abstract/query_cache.rb +1 -1
- data/lib/active_record/connection_adapters/abstract/schema_definitions.rb +4 -0
- data/lib/active_record/connection_adapters/abstract/schema_statements.rb +7 -1
- data/lib/active_record/connection_adapters/abstract_adapter.rb +7 -8
- data/lib/active_record/connection_adapters/mysql/quoting.rb +17 -2
- data/lib/active_record/connection_adapters/mysql/schema_dumper.rb +4 -1
- data/lib/active_record/connection_adapters/pool_config.rb +13 -3
- data/lib/active_record/connection_adapters/postgresql/database_statements.rb +1 -1
- data/lib/active_record/connection_adapters/postgresql/oid/money.rb +2 -2
- data/lib/active_record/connection_adapters/postgresql_adapter.rb +2 -8
- data/lib/active_record/connection_adapters/sqlite3_adapter.rb +1 -1
- data/lib/active_record/connection_handling.rb +20 -12
- data/lib/active_record/core.rb +42 -24
- data/lib/active_record/database_configurations/url_config.rb +1 -1
- data/lib/active_record/enum.rb +48 -28
- data/lib/active_record/fixtures.rb +5 -2
- data/lib/active_record/gem_version.rb +2 -2
- data/lib/active_record/locking/optimistic.rb +14 -4
- data/lib/active_record/log_subscriber.rb +3 -2
- data/lib/active_record/migration.rb +1 -1
- data/lib/active_record/migration/compatibility.rb +2 -1
- data/lib/active_record/model_schema.rb +4 -4
- data/lib/active_record/railties/console_sandbox.rb +2 -4
- data/lib/active_record/railties/databases.rake +13 -7
- data/lib/active_record/reflection.rb +1 -1
- data/lib/active_record/relation.rb +1 -2
- data/lib/active_record/relation/finder_methods.rb +1 -1
- data/lib/active_record/relation/predicate_builder.rb +5 -6
- data/lib/active_record/relation/predicate_builder/association_query_value.rb +3 -3
- data/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb +9 -5
- data/lib/active_record/relation/query_methods.rb +8 -5
- data/lib/active_record/relation/where_clause.rb +5 -5
- data/lib/active_record/signed_id.rb +1 -1
- data/lib/active_record/table_metadata.rb +6 -3
- data/lib/active_record/tasks/database_tasks.rb +1 -0
- data/lib/active_record/transactions.rb +4 -2
- metadata +10 -10
@@ -58,8 +58,8 @@ module ActiveRecord
|
|
58
58
|
end
|
59
59
|
end
|
60
60
|
|
61
|
-
def to_h(table_name = nil)
|
62
|
-
equalities(predicates).each_with_object({}) do |node, hash|
|
61
|
+
def to_h(table_name = nil, equality_only: false)
|
62
|
+
equalities(predicates, equality_only).each_with_object({}) do |node, hash|
|
63
63
|
next if table_name&.!= node.left.relation.name
|
64
64
|
name = node.left.name.to_s
|
65
65
|
value = extract_node_value(node.right)
|
@@ -134,14 +134,14 @@ module ActiveRecord
|
|
134
134
|
attr_node
|
135
135
|
end
|
136
136
|
|
137
|
-
def equalities(predicates)
|
137
|
+
def equalities(predicates, equality_only)
|
138
138
|
equalities = []
|
139
139
|
|
140
140
|
predicates.each do |node|
|
141
|
-
if equality_node?(node)
|
141
|
+
if equality_only ? Arel::Nodes::Equality === node : equality_node?(node)
|
142
142
|
equalities << node
|
143
143
|
elsif node.is_a?(Arel::Nodes::And)
|
144
|
-
equalities.concat equalities(node.children)
|
144
|
+
equalities.concat equalities(node.children, equality_only)
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
@@ -20,7 +20,7 @@ module ActiveRecord
|
|
20
20
|
# a certain time period.
|
21
21
|
#
|
22
22
|
# You set the time period that the signed id is valid for during generation, using the instance method
|
23
|
-
#
|
23
|
+
# <tt>signed_id(expires_in: 15.minutes)</tt>. If the time has elapsed before a signed find is attempted,
|
24
24
|
# the signed id will no longer be valid, and nil is returned.
|
25
25
|
#
|
26
26
|
# It's possible to further restrict the use of a signed id with a purpose. This helps when you have a
|
@@ -33,10 +33,13 @@ module ActiveRecord
|
|
33
33
|
return self
|
34
34
|
end
|
35
35
|
|
36
|
-
|
36
|
+
if reflection
|
37
|
+
association_klass = reflection.klass unless reflection.polymorphic?
|
38
|
+
elsif block_given?
|
39
|
+
association_klass = yield table_name
|
40
|
+
end
|
37
41
|
|
38
|
-
if
|
39
|
-
association_klass = reflection.klass
|
42
|
+
if association_klass
|
40
43
|
arel_table = association_klass.arel_table
|
41
44
|
arel_table = arel_table.alias(table_name) if arel_table.name != table_name
|
42
45
|
TableMetadata.new(association_klass, arel_table, reflection)
|
@@ -271,8 +271,10 @@ module ActiveRecord
|
|
271
271
|
if options[:on]
|
272
272
|
fire_on = Array(options[:on])
|
273
273
|
assert_valid_transaction_action(fire_on)
|
274
|
-
options[:if] =
|
275
|
-
|
274
|
+
options[:if] = [
|
275
|
+
-> { transaction_include_any_action?(fire_on) },
|
276
|
+
*options[:if]
|
277
|
+
]
|
276
278
|
end
|
277
279
|
end
|
278
280
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: activerecord
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.1.
|
4
|
+
version: 6.1.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 6.1.
|
19
|
+
version: 6.1.3.1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 6.1.
|
26
|
+
version: 6.1.3.1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: activemodel
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 6.1.
|
33
|
+
version: 6.1.3.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 6.1.
|
40
|
+
version: 6.1.3.1
|
41
41
|
description: Databases on Rails. Build a persistent domain model by mapping database
|
42
42
|
tables to Ruby classes. Strong conventions for associations, validations, aggregations,
|
43
43
|
migrations, and testing come baked-in.
|
@@ -390,10 +390,10 @@ licenses:
|
|
390
390
|
- MIT
|
391
391
|
metadata:
|
392
392
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
393
|
-
changelog_uri: https://github.com/rails/rails/blob/v6.1.
|
394
|
-
documentation_uri: https://api.rubyonrails.org/v6.1.
|
393
|
+
changelog_uri: https://github.com/rails/rails/blob/v6.1.3.1/activerecord/CHANGELOG.md
|
394
|
+
documentation_uri: https://api.rubyonrails.org/v6.1.3.1/
|
395
395
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
396
|
-
source_code_uri: https://github.com/rails/rails/tree/v6.1.
|
396
|
+
source_code_uri: https://github.com/rails/rails/tree/v6.1.3.1/activerecord
|
397
397
|
post_install_message:
|
398
398
|
rdoc_options:
|
399
399
|
- "--main"
|
@@ -411,7 +411,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
411
411
|
- !ruby/object:Gem::Version
|
412
412
|
version: '0'
|
413
413
|
requirements: []
|
414
|
-
rubygems_version: 3.1.
|
414
|
+
rubygems_version: 3.1.2
|
415
415
|
signing_key:
|
416
416
|
specification_version: 4
|
417
417
|
summary: Object-relational mapper framework (part of Rails).
|