activerecord 6.1.1 → 6.1.3
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 +120 -0
- data/README.rdoc +1 -1
- data/lib/active_record/association_relation.rb +10 -0
- data/lib/active_record/associations/association.rb +7 -7
- data/lib/active_record/associations/builder/association.rb +23 -2
- data/lib/active_record/associations/join_dependency.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_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/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 +19 -13
- data/lib/active_record/fixtures.rb +1 -1
- data/lib/active_record/gem_version.rb +1 -1
- 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/model_schema.rb +4 -4
- data/lib/active_record/railties/console_sandbox.rb +2 -4
- 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 +3 -1
- data/lib/active_record/relation/predicate_builder/association_query_value.rb +1 -1
- data/lib/active_record/relation/predicate_builder/polymorphic_array_value.rb +2 -0
- data/lib/active_record/relation/where_clause.rb +5 -5
- metadata +9 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6cdd6094f92ff2d3eef67e5ab7f2a8e2a327fbdffaa1f20182fb5bdb7c803685
|
4
|
+
data.tar.gz: 197e68aa68f0946e9fcd55c7f0c2f41c237777c893b20a3a00affddbcaa1f367
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b9b18c89048afe658359cd16b4c13c3a1eb87c8dacae3beeaf99338e2e441f64fd96bf569697cd581ea35f3068f33ee7872f733570f621a774c92b04253dc5e
|
7
|
+
data.tar.gz: 4d47d251881e21878596707b1d759f40b8b83a02e759cb1af79d8293498251a6ff3f5b11e4ecdc004ac282c6fc84437bcc60469bf0ed0a880aae1e820e20d4a1
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,123 @@
|
|
1
|
+
## Rails 6.1.3 (February 17, 2021) ##
|
2
|
+
|
3
|
+
* Fix the MySQL adapter to always set the right collation and charset
|
4
|
+
to the connection session.
|
5
|
+
|
6
|
+
*Rafael Mendonça França*
|
7
|
+
|
8
|
+
* Fix MySQL adapter handling of time objects when prepared statements
|
9
|
+
are enabled.
|
10
|
+
|
11
|
+
*Rafael Mendonça França*
|
12
|
+
|
13
|
+
* Fix scoping in enum fields using conditions that would generate
|
14
|
+
an `IN` clause.
|
15
|
+
|
16
|
+
*Ryuta Kamizono*
|
17
|
+
|
18
|
+
* Skip optimised #exist? query when #include? is called on a relation
|
19
|
+
with a having clause
|
20
|
+
|
21
|
+
Relations that have aliased select values AND a having clause that
|
22
|
+
references an aliased select value would generate an error when
|
23
|
+
#include? was called, due to an optimisation that would generate
|
24
|
+
call #exists? on the relation instead, which effectively alters
|
25
|
+
the select values of the query (and thus removes the aliased select
|
26
|
+
values), but leaves the having clause intact. Because the having
|
27
|
+
clause is then referencing an aliased column that is no longer
|
28
|
+
present in the simplified query, an ActiveRecord::InvalidStatement
|
29
|
+
error was raised.
|
30
|
+
|
31
|
+
An sample query affected by this problem:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
Author.select('COUNT(*) as total_posts', 'authors.*')
|
35
|
+
.joins(:posts)
|
36
|
+
.group(:id)
|
37
|
+
.having('total_posts > 2')
|
38
|
+
.include?(Author.first)
|
39
|
+
```
|
40
|
+
|
41
|
+
This change adds an addition check to the condition that skips the
|
42
|
+
simplified #exists? query, which simply checks for the presence of
|
43
|
+
a having clause.
|
44
|
+
|
45
|
+
Fixes #41417
|
46
|
+
|
47
|
+
*Michael Smart*
|
48
|
+
|
49
|
+
* Increment postgres prepared statement counter before making a prepared statement, so if the statement is aborted
|
50
|
+
without Rails knowledge (e.g., if app gets kill -9d during long-running query or due to Rack::Timeout), app won't end
|
51
|
+
up in perpetual crash state for being inconsistent with Postgres.
|
52
|
+
|
53
|
+
*wbharding*, *Martin Tepper*
|
54
|
+
|
55
|
+
|
56
|
+
## Rails 6.1.2.1 (February 10, 2021) ##
|
57
|
+
|
58
|
+
* Fix possible DoS vector in PostgreSQL money type
|
59
|
+
|
60
|
+
Carefully crafted input can cause a DoS via the regular expressions used
|
61
|
+
for validating the money format in the PostgreSQL adapter. This patch
|
62
|
+
fixes the regexp.
|
63
|
+
|
64
|
+
Thanks to @dee-see from Hackerone for this patch!
|
65
|
+
|
66
|
+
[CVE-2021-22880]
|
67
|
+
|
68
|
+
*Aaron Patterson*
|
69
|
+
|
70
|
+
|
71
|
+
## Rails 6.1.2 (February 09, 2021) ##
|
72
|
+
|
73
|
+
* Fix timestamp type for sqlite3.
|
74
|
+
|
75
|
+
*Eileen M. Uchitelle*
|
76
|
+
|
77
|
+
* Make destroy async transactional.
|
78
|
+
|
79
|
+
An active record rollback could occur while enqueuing a job. In this
|
80
|
+
case the job would enqueue even though the database deletion
|
81
|
+
rolledback putting things in a funky state.
|
82
|
+
|
83
|
+
Now the jobs are only enqueued until after the db transaction has been committed.
|
84
|
+
|
85
|
+
*Cory Gwin*
|
86
|
+
|
87
|
+
* Fix malformed packet error in MySQL statement for connection configuration.
|
88
|
+
|
89
|
+
*robinroestenburg*
|
90
|
+
|
91
|
+
* Connection specification now passes the "url" key as a configuration for the
|
92
|
+
adapter if the "url" protocol is "jdbc", "http", or "https". Previously only
|
93
|
+
urls with the "jdbc" prefix were passed to the Active Record Adapter, others
|
94
|
+
are assumed to be adapter specification urls.
|
95
|
+
|
96
|
+
Fixes #41137.
|
97
|
+
|
98
|
+
*Jonathan Bracy*
|
99
|
+
|
100
|
+
* Fix granular connection swapping when there are multiple abstract classes.
|
101
|
+
|
102
|
+
*Eileen M. Uchitelle*
|
103
|
+
|
104
|
+
* Fix `find_by` with custom primary key for belongs_to association.
|
105
|
+
|
106
|
+
*Ryuta Kamizono*
|
107
|
+
|
108
|
+
* Add support for `rails console --sandbox` for multiple database applications.
|
109
|
+
|
110
|
+
*alpaca-tc*
|
111
|
+
|
112
|
+
* Fix `where` on polymorphic association with empty array.
|
113
|
+
|
114
|
+
*Ryuta Kamizono*
|
115
|
+
|
116
|
+
* Fix preventing writes for `ApplicationRecord`.
|
117
|
+
|
118
|
+
*Eileen M. Uchitelle*
|
119
|
+
|
120
|
+
|
1
121
|
## Rails 6.1.1 (January 07, 2021) ##
|
2
122
|
|
3
123
|
* Fix fixtures loading when strict loading is enabled for the association.
|
data/README.rdoc
CHANGED
@@ -194,7 +194,7 @@ The latest version of Active Record can be installed with RubyGems:
|
|
194
194
|
|
195
195
|
Source code can be downloaded as part of the Rails project on GitHub:
|
196
196
|
|
197
|
-
* https://github.com/rails/rails/tree/
|
197
|
+
* https://github.com/rails/rails/tree/main/activerecord
|
198
198
|
|
199
199
|
|
200
200
|
== License
|
@@ -27,6 +27,16 @@ module ActiveRecord
|
|
27
27
|
RUBY
|
28
28
|
end
|
29
29
|
|
30
|
+
def build(attributes = nil, &block)
|
31
|
+
if attributes.is_a?(Array)
|
32
|
+
attributes.collect { |attr| build(attr, &block) }
|
33
|
+
else
|
34
|
+
block = current_scope_restoring_block(&block)
|
35
|
+
scoping { _new(attributes, &block) }
|
36
|
+
end
|
37
|
+
end
|
38
|
+
alias new build
|
39
|
+
|
30
40
|
private
|
31
41
|
def _new(attributes, &block)
|
32
42
|
@association.build(attributes, &block)
|
@@ -211,12 +211,8 @@ module ActiveRecord
|
|
211
211
|
|
212
212
|
private
|
213
213
|
def find_target
|
214
|
-
if owner.strict_loading? && owner.validation_context.nil?
|
215
|
-
Base.strict_loading_violation!(owner: owner.class,
|
216
|
-
end
|
217
|
-
|
218
|
-
if reflection.strict_loading? && owner.validation_context.nil?
|
219
|
-
Base.strict_loading_violation!(owner: owner.class, association: reflection.name)
|
214
|
+
if (owner.strict_loading? || reflection.strict_loading?) && owner.validation_context.nil?
|
215
|
+
Base.strict_loading_violation!(owner: owner.class, reflection: reflection)
|
220
216
|
end
|
221
217
|
|
222
218
|
scope = self.scope
|
@@ -331,7 +327,11 @@ module ActiveRecord
|
|
331
327
|
end
|
332
328
|
|
333
329
|
def enqueue_destroy_association(options)
|
334
|
-
owner.class.destroy_association_async_job
|
330
|
+
job_class = owner.class.destroy_association_async_job
|
331
|
+
|
332
|
+
if job_class
|
333
|
+
owner._after_commit_jobs.push([job_class, options])
|
334
|
+
end
|
335
335
|
end
|
336
336
|
|
337
337
|
def inversable?(record)
|
@@ -76,6 +76,7 @@ module ActiveRecord::Associations::Builder # :nodoc:
|
|
76
76
|
if dependent = reflection.options[:dependent]
|
77
77
|
check_dependent_options(dependent, model)
|
78
78
|
add_destroy_callbacks(model, reflection)
|
79
|
+
add_after_commit_jobs_callback(model, dependent)
|
79
80
|
end
|
80
81
|
|
81
82
|
Association.extensions.each do |extension|
|
@@ -132,11 +133,31 @@ module ActiveRecord::Associations::Builder # :nodoc:
|
|
132
133
|
|
133
134
|
def self.add_destroy_callbacks(model, reflection)
|
134
135
|
name = reflection.name
|
135
|
-
model.before_destroy
|
136
|
+
model.before_destroy(->(o) { o.association(name).handle_dependency })
|
137
|
+
end
|
138
|
+
|
139
|
+
def self.add_after_commit_jobs_callback(model, dependent)
|
140
|
+
if dependent == :destroy_async
|
141
|
+
mixin = model.generated_association_methods
|
142
|
+
|
143
|
+
unless mixin.method_defined?(:_after_commit_jobs)
|
144
|
+
model.after_commit(-> do
|
145
|
+
_after_commit_jobs.each do |job_class, job_arguments|
|
146
|
+
job_class.perform_later(**job_arguments)
|
147
|
+
end
|
148
|
+
end)
|
149
|
+
|
150
|
+
mixin.class_eval <<-CODE, __FILE__, __LINE__ + 1
|
151
|
+
def _after_commit_jobs
|
152
|
+
@_after_commit_jobs ||= []
|
153
|
+
end
|
154
|
+
CODE
|
155
|
+
end
|
156
|
+
end
|
136
157
|
end
|
137
158
|
|
138
159
|
private_class_method :build_scope, :macro, :valid_options, :validate_options, :define_extensions,
|
139
160
|
:define_callbacks, :define_accessors, :define_readers, :define_writers, :define_validations,
|
140
|
-
:valid_dependent_options, :check_dependent_options, :add_destroy_callbacks
|
161
|
+
:valid_dependent_options, :check_dependent_options, :add_destroy_callbacks, :add_after_commit_jobs_callback
|
141
162
|
end
|
142
163
|
end
|
@@ -195,7 +195,7 @@ module ActiveRecord
|
|
195
195
|
next table, true
|
196
196
|
end
|
197
197
|
|
198
|
-
table_name = @references[reflection.name.to_sym]
|
198
|
+
table_name = @references[reflection.name.to_sym]&.to_s
|
199
199
|
|
200
200
|
table = alias_tracker.aliased_table_for(reflection.klass.arel_table, table_name) do
|
201
201
|
name = reflection.alias_candidate(parent.table_name)
|
@@ -24,7 +24,7 @@ module ActiveRecord
|
|
24
24
|
|
25
25
|
attr_accessor :schema_cache
|
26
26
|
|
27
|
-
def
|
27
|
+
def connection_klass
|
28
28
|
nil
|
29
29
|
end
|
30
30
|
end
|
@@ -360,7 +360,7 @@ module ActiveRecord
|
|
360
360
|
include ConnectionAdapters::AbstractPool
|
361
361
|
|
362
362
|
attr_accessor :automatic_reconnect, :checkout_timeout
|
363
|
-
attr_reader :db_config, :size, :reaper, :pool_config, :
|
363
|
+
attr_reader :db_config, :size, :reaper, :pool_config, :connection_klass
|
364
364
|
|
365
365
|
delegate :schema_cache, :schema_cache=, to: :pool_config
|
366
366
|
|
@@ -375,7 +375,7 @@ module ActiveRecord
|
|
375
375
|
|
376
376
|
@pool_config = pool_config
|
377
377
|
@db_config = pool_config.db_config
|
378
|
-
@
|
378
|
+
@connection_klass = pool_config.connection_klass
|
379
379
|
|
380
380
|
@checkout_timeout = db_config.checkout_timeout
|
381
381
|
@idle_timeout = db_config.idle_timeout
|
@@ -1040,7 +1040,7 @@ module ActiveRecord
|
|
1040
1040
|
end
|
1041
1041
|
alias :connection_pools :connection_pool_list
|
1042
1042
|
|
1043
|
-
def establish_connection(config, owner_name: Base
|
1043
|
+
def establish_connection(config, owner_name: Base, role: ActiveRecord::Base.current_role, shard: Base.current_shard)
|
1044
1044
|
owner_name = config.to_s if config.is_a?(Symbol)
|
1045
1045
|
|
1046
1046
|
pool_config = resolve_pool_config(config, owner_name)
|
@@ -395,7 +395,7 @@ module ActiveRecord
|
|
395
395
|
|
396
396
|
# Inserts the given fixture into the table. Overridden in adapters that require
|
397
397
|
# something beyond a simple insert (e.g. Oracle).
|
398
|
-
# Most of adapters should implement
|
398
|
+
# Most of adapters should implement +insert_fixtures_set+ that leverages bulk SQL insert.
|
399
399
|
# We keep this method to provide fallback
|
400
400
|
# for databases like sqlite that do not support bulk inserts.
|
401
401
|
def insert_fixture(fixture, table_name)
|
@@ -7,7 +7,7 @@ module ActiveRecord
|
|
7
7
|
module QueryCache
|
8
8
|
class << self
|
9
9
|
def included(base) #:nodoc:
|
10
|
-
dirties_query_cache base, :insert, :update, :delete, :truncate, :truncate_tables,
|
10
|
+
dirties_query_cache base, :create, :insert, :update, :delete, :truncate, :truncate_tables,
|
11
11
|
:rollback_to_savepoint, :rollback_db_transaction, :exec_insert_all
|
12
12
|
|
13
13
|
base.set_callback :checkout, :after, :configure_query_cache!
|
@@ -111,22 +111,21 @@ module ActiveRecord
|
|
111
111
|
@config.fetch(:use_metadata_table, true)
|
112
112
|
end
|
113
113
|
|
114
|
-
# Determines whether writes are currently being
|
114
|
+
# Determines whether writes are currently being prevented.
|
115
115
|
#
|
116
116
|
# Returns true if the connection is a replica.
|
117
117
|
#
|
118
118
|
# If the application is using legacy handling, returns
|
119
|
-
# true if
|
119
|
+
# true if +connection_handler.prevent_writes+ is set.
|
120
120
|
#
|
121
121
|
# If the application is using the new connection handling
|
122
|
-
# will return true based on
|
122
|
+
# will return true based on +current_preventing_writes+.
|
123
123
|
def preventing_writes?
|
124
124
|
return true if replica?
|
125
125
|
return ActiveRecord::Base.connection_handler.prevent_writes if ActiveRecord::Base.legacy_connection_handling
|
126
|
-
return false if
|
126
|
+
return false if connection_klass.nil?
|
127
127
|
|
128
|
-
|
129
|
-
klass&.current_preventing_writes
|
128
|
+
connection_klass.current_preventing_writes
|
130
129
|
end
|
131
130
|
|
132
131
|
def migrations_paths # :nodoc:
|
@@ -202,8 +201,8 @@ module ActiveRecord
|
|
202
201
|
@owner = Thread.current
|
203
202
|
end
|
204
203
|
|
205
|
-
def
|
206
|
-
@pool.
|
204
|
+
def connection_klass # :nodoc:
|
205
|
+
@pool.connection_klass
|
207
206
|
end
|
208
207
|
|
209
208
|
def schema_cache
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require "active_support/time_with_zone"
|
4
|
+
|
3
5
|
module ActiveRecord
|
4
6
|
module ConnectionAdapters
|
5
7
|
module MySQL
|
@@ -69,10 +71,23 @@ module ActiveRecord
|
|
69
71
|
private_constant :COLUMN_NAME, :COLUMN_NAME_WITH_ORDER
|
70
72
|
|
71
73
|
private
|
74
|
+
# Override +_type_cast+ we pass to mysql2 Date and Time objects instead
|
75
|
+
# of Strings since mysql2 is able to handle those classes more efficiently.
|
72
76
|
def _type_cast(value)
|
73
77
|
case value
|
74
|
-
when
|
75
|
-
|
78
|
+
when ActiveSupport::TimeWithZone
|
79
|
+
# We need to check explicitly for ActiveSupport::TimeWithZone because
|
80
|
+
# we need to transform it to Time objects but we don't want to
|
81
|
+
# transform Time objects to themselves.
|
82
|
+
if ActiveRecord::Base.default_timezone == :utc
|
83
|
+
value.getutc
|
84
|
+
else
|
85
|
+
value.getlocal
|
86
|
+
end
|
87
|
+
when Date, Time
|
88
|
+
value
|
89
|
+
else
|
90
|
+
super
|
76
91
|
end
|
77
92
|
end
|
78
93
|
end
|
@@ -79,7 +79,10 @@ module ActiveRecord
|
|
79
79
|
" WHERE table_schema = #{scope[:schema]}" \
|
80
80
|
" AND table_name = #{scope[:name]}" \
|
81
81
|
" AND column_name = #{column_name}"
|
82
|
-
|
82
|
+
# Calling .inspect leads into issues with the query result
|
83
|
+
# which already returns escaped quotes.
|
84
|
+
# We remove the escape sequence from the result in order to deal with double escaping issues.
|
85
|
+
@connection.query_value(sql, "SCHEMA").gsub("\\'", "'").inspect
|
83
86
|
end
|
84
87
|
end
|
85
88
|
end
|
@@ -5,7 +5,7 @@ module ActiveRecord
|
|
5
5
|
class PoolConfig # :nodoc:
|
6
6
|
include Mutex_m
|
7
7
|
|
8
|
-
attr_reader :db_config, :
|
8
|
+
attr_reader :db_config, :connection_klass
|
9
9
|
attr_accessor :schema_cache
|
10
10
|
|
11
11
|
INSTANCES = ObjectSpace::WeakMap.new
|
@@ -17,14 +17,24 @@ module ActiveRecord
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
def initialize(
|
20
|
+
def initialize(connection_klass, db_config)
|
21
21
|
super()
|
22
|
-
@
|
22
|
+
@connection_klass = connection_klass
|
23
23
|
@db_config = db_config
|
24
24
|
@pool = nil
|
25
25
|
INSTANCES[self] = self
|
26
26
|
end
|
27
27
|
|
28
|
+
def connection_specification_name
|
29
|
+
if connection_klass.is_a?(String)
|
30
|
+
connection_klass
|
31
|
+
elsif connection_klass.primary_class?
|
32
|
+
"ActiveRecord::Base"
|
33
|
+
else
|
34
|
+
connection_klass.name
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
28
38
|
def disconnect!
|
29
39
|
ActiveSupport::ForkTracker.check!
|
30
40
|
|
@@ -26,9 +26,9 @@ module ActiveRecord
|
|
26
26
|
|
27
27
|
value = value.sub(/^\((.+)\)$/, '-\1') # (4)
|
28
28
|
case value
|
29
|
-
when /^-?\D
|
29
|
+
when /^-?\D*+[\d,]+\.\d{2}$/ # (1)
|
30
30
|
value.gsub!(/[^-\d.]/, "")
|
31
|
-
when /^-?\D
|
31
|
+
when /^-?\D*+[\d.]+,\d{2}$/ # (2)
|
32
32
|
value.gsub!(/[^-\d,]/, "").sub!(/,/, ".")
|
33
33
|
end
|
34
34
|
|
@@ -227,11 +227,7 @@ module ActiveRecord
|
|
227
227
|
end
|
228
228
|
|
229
229
|
def next_key
|
230
|
-
"a#{@counter
|
231
|
-
end
|
232
|
-
|
233
|
-
def []=(sql, key)
|
234
|
-
super.tap { @counter += 1 }
|
230
|
+
"a#{@counter += 1}"
|
235
231
|
end
|
236
232
|
|
237
233
|
private
|
@@ -649,9 +645,7 @@ module ActiveRecord
|
|
649
645
|
raise ActiveRecord::ReadOnlyError, "Write query attempted while in readonly mode: #{sql}"
|
650
646
|
end
|
651
647
|
|
652
|
-
if without_prepared_statement?(binds)
|
653
|
-
result = exec_no_cache(sql, name, [])
|
654
|
-
elsif !prepare
|
648
|
+
if !prepare || without_prepared_statement?(binds)
|
655
649
|
result = exec_no_cache(sql, name, binds)
|
656
650
|
else
|
657
651
|
result = exec_cache(sql, name, binds)
|
@@ -271,7 +271,7 @@ module ActiveRecord
|
|
271
271
|
def change_column(table_name, column_name, type, **options) #:nodoc:
|
272
272
|
alter_table(table_name) do |definition|
|
273
273
|
definition[column_name].instance_eval do
|
274
|
-
self.type = type
|
274
|
+
self.type = aliased_types(type.to_s, type)
|
275
275
|
self.options.merge!(options)
|
276
276
|
end
|
277
277
|
end
|
@@ -91,6 +91,7 @@ module ActiveRecord
|
|
91
91
|
db_config, owner_name = resolve_config_for_connection(database_key)
|
92
92
|
handler = lookup_connection_handler(role.to_sym)
|
93
93
|
|
94
|
+
self.connection_class = true
|
94
95
|
connections << handler.establish_connection(db_config, owner_name: owner_name, role: role)
|
95
96
|
end
|
96
97
|
|
@@ -99,6 +100,7 @@ module ActiveRecord
|
|
99
100
|
db_config, owner_name = resolve_config_for_connection(database_key)
|
100
101
|
handler = lookup_connection_handler(role.to_sym)
|
101
102
|
|
103
|
+
self.connection_class = true
|
102
104
|
connections << handler.establish_connection(db_config, owner_name: owner_name, role: role, shard: shard.to_sym)
|
103
105
|
end
|
104
106
|
end
|
@@ -112,7 +114,7 @@ module ActiveRecord
|
|
112
114
|
#
|
113
115
|
# If only a role is passed, Active Record will look up the connection
|
114
116
|
# based on the requested role. If a non-established role is requested
|
115
|
-
# an
|
117
|
+
# an +ActiveRecord::ConnectionNotEstablished+ error will be raised:
|
116
118
|
#
|
117
119
|
# ActiveRecord::Base.connected_to(role: :writing) do
|
118
120
|
# Dog.create! # creates dog using dog writing connection
|
@@ -123,7 +125,7 @@ module ActiveRecord
|
|
123
125
|
# end
|
124
126
|
#
|
125
127
|
# When swapping to a shard, the role must be passed as well. If a non-existent
|
126
|
-
# shard is passed, an
|
128
|
+
# shard is passed, an +ActiveRecord::ConnectionNotEstablished+ error will be
|
127
129
|
# raised.
|
128
130
|
#
|
129
131
|
# When a shard and role is passed, Active Record will first lookup the role,
|
@@ -143,6 +145,10 @@ module ActiveRecord
|
|
143
145
|
if self != Base && !abstract_class
|
144
146
|
raise NotImplementedError, "calling `connected_to` is only allowed on ActiveRecord::Base or abstract classes."
|
145
147
|
end
|
148
|
+
|
149
|
+
if name != connection_specification_name && !primary_class?
|
150
|
+
raise NotImplementedError, "calling `connected_to` is only allowed on the abstract class that established the connection."
|
151
|
+
end
|
146
152
|
end
|
147
153
|
|
148
154
|
if database && (role || shard)
|
@@ -172,20 +178,22 @@ module ActiveRecord
|
|
172
178
|
end
|
173
179
|
end
|
174
180
|
|
175
|
-
# Connects a role and/or shard to the provided connection names. Optionally
|
176
|
-
# can be passed to block writes on a connection.
|
177
|
-
#
|
181
|
+
# Connects a role and/or shard to the provided connection names. Optionally +prevent_writes+
|
182
|
+
# can be passed to block writes on a connection. +reading+ will automatically set
|
183
|
+
# +prevent_writes+ to true.
|
178
184
|
#
|
179
|
-
#
|
185
|
+
# +connected_to_many+ is an alternative to deeply nested +connected_to+ blocks.
|
180
186
|
#
|
181
187
|
# Usage:
|
182
188
|
#
|
183
|
-
# ActiveRecord::Base.
|
189
|
+
# ActiveRecord::Base.connected_to_many(AnimalsRecord, MealsRecord, role: :reading) do
|
184
190
|
# Dog.first # Read from animals replica
|
185
191
|
# Dinner.first # Read from meals replica
|
186
192
|
# Person.first # Read from primary writer
|
187
193
|
# end
|
188
|
-
def connected_to_many(classes, role:, shard: nil, prevent_writes: false)
|
194
|
+
def connected_to_many(*classes, role:, shard: nil, prevent_writes: false)
|
195
|
+
classes = classes.flatten
|
196
|
+
|
189
197
|
if legacy_connection_handling
|
190
198
|
raise NotImplementedError, "connected_to_many is not available with legacy connection handling"
|
191
199
|
end
|
@@ -208,7 +216,7 @@ module ActiveRecord
|
|
208
216
|
# being used. For example, when booting a console in readonly mode.
|
209
217
|
#
|
210
218
|
# It is not recommended to use this method in a request since it
|
211
|
-
# does not yield to a block like
|
219
|
+
# does not yield to a block like +connected_to+.
|
212
220
|
def connecting_to(role: default_role, shard: default_shard, prevent_writes: false)
|
213
221
|
if legacy_connection_handling
|
214
222
|
raise NotImplementedError, "`connecting_to` is not available with `legacy_connection_handling`."
|
@@ -222,13 +230,13 @@ module ActiveRecord
|
|
222
230
|
# Prevent writing to the database regardless of role.
|
223
231
|
#
|
224
232
|
# In some cases you may want to prevent writes to the database
|
225
|
-
# even if you are on a database that can write.
|
233
|
+
# even if you are on a database that can write. +while_preventing_writes+
|
226
234
|
# will prevent writes to the database for the duration of the block.
|
227
235
|
#
|
228
236
|
# This method does not provide the same protection as a readonly
|
229
237
|
# user and is meant to be a safeguard against accidental writes.
|
230
238
|
#
|
231
|
-
# See
|
239
|
+
# See +READ_QUERY+ for the queries that are blocked by this
|
232
240
|
# method.
|
233
241
|
def while_preventing_writes(enabled = true, &block)
|
234
242
|
if legacy_connection_handling
|
@@ -357,7 +365,7 @@ module ActiveRecord
|
|
357
365
|
self.connection_specification_name = owner_name
|
358
366
|
|
359
367
|
db_config = Base.configurations.resolve(config_or_env)
|
360
|
-
[db_config,
|
368
|
+
[db_config, self]
|
361
369
|
end
|
362
370
|
|
363
371
|
def with_handler(handler_key, &blk)
|
data/lib/active_record/core.rb
CHANGED
@@ -196,7 +196,7 @@ module ActiveRecord
|
|
196
196
|
else
|
197
197
|
connected_to_stack.reverse_each do |hash|
|
198
198
|
return hash[:role] if hash[:role] && hash[:klasses].include?(Base)
|
199
|
-
return hash[:role] if hash[:role] && hash[:klasses].include?(
|
199
|
+
return hash[:role] if hash[:role] && hash[:klasses].include?(connection_classes)
|
200
200
|
end
|
201
201
|
|
202
202
|
default_role
|
@@ -215,7 +215,7 @@ module ActiveRecord
|
|
215
215
|
def self.current_shard
|
216
216
|
connected_to_stack.reverse_each do |hash|
|
217
217
|
return hash[:shard] if hash[:shard] && hash[:klasses].include?(Base)
|
218
|
-
return hash[:shard] if hash[:shard] && hash[:klasses].include?(
|
218
|
+
return hash[:shard] if hash[:shard] && hash[:klasses].include?(connection_classes)
|
219
219
|
end
|
220
220
|
|
221
221
|
default_shard
|
@@ -237,7 +237,7 @@ module ActiveRecord
|
|
237
237
|
else
|
238
238
|
connected_to_stack.reverse_each do |hash|
|
239
239
|
return hash[:prevent_writes] if !hash[:prevent_writes].nil? && hash[:klasses].include?(Base)
|
240
|
-
return hash[:prevent_writes] if !hash[:prevent_writes].nil? && hash[:klasses].include?(
|
240
|
+
return hash[:prevent_writes] if !hash[:prevent_writes].nil? && hash[:klasses].include?(connection_classes)
|
241
241
|
end
|
242
242
|
|
243
243
|
false
|
@@ -254,11 +254,23 @@ module ActiveRecord
|
|
254
254
|
end
|
255
255
|
end
|
256
256
|
|
257
|
-
def self.
|
257
|
+
def self.connection_class=(b) # :nodoc:
|
258
|
+
@connection_class = b
|
259
|
+
end
|
260
|
+
|
261
|
+
def self.connection_class # :nodoc
|
262
|
+
@connection_class ||= false
|
263
|
+
end
|
264
|
+
|
265
|
+
def self.connection_class? # :nodoc:
|
266
|
+
self.connection_class
|
267
|
+
end
|
268
|
+
|
269
|
+
def self.connection_classes # :nodoc:
|
258
270
|
klass = self
|
259
271
|
|
260
272
|
until klass == Base
|
261
|
-
break if klass.
|
273
|
+
break if klass.connection_class?
|
262
274
|
klass = klass.superclass
|
263
275
|
end
|
264
276
|
|
@@ -277,14 +289,14 @@ module ActiveRecord
|
|
277
289
|
self.default_role = writing_role
|
278
290
|
self.default_shard = :default
|
279
291
|
|
280
|
-
def self.strict_loading_violation!(owner:,
|
292
|
+
def self.strict_loading_violation!(owner:, reflection:) # :nodoc:
|
281
293
|
case action_on_strict_loading_violation
|
282
294
|
when :raise
|
283
|
-
message = "`#{
|
295
|
+
message = "`#{owner}` is marked for strict_loading. The `#{reflection.klass}` association named `:#{reflection.name}` cannot be lazily loaded."
|
284
296
|
raise ActiveRecord::StrictLoadingViolationError.new(message)
|
285
297
|
when :log
|
286
298
|
name = "strict_loading_violation.active_record"
|
287
|
-
ActiveSupport::Notifications.instrument(name, owner: owner,
|
299
|
+
ActiveSupport::Notifications.instrument(name, owner: owner, reflection: reflection)
|
288
300
|
end
|
289
301
|
end
|
290
302
|
end
|
@@ -332,31 +344,37 @@ module ActiveRecord
|
|
332
344
|
hash = args.first
|
333
345
|
return super unless Hash === hash
|
334
346
|
|
335
|
-
|
336
|
-
|
337
|
-
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
|
343
|
-
|
344
|
-
|
345
|
-
|
346
|
-
|
347
|
-
|
347
|
+
hash = hash.each_with_object({}) do |(key, value), h|
|
348
|
+
key = key.to_s
|
349
|
+
key = attribute_aliases[key] || key
|
350
|
+
|
351
|
+
return super if reflect_on_aggregation(key)
|
352
|
+
|
353
|
+
reflection = _reflect_on_association(key)
|
354
|
+
|
355
|
+
if !reflection
|
356
|
+
value = value.id if value.respond_to?(:id)
|
357
|
+
elsif reflection.belongs_to? && !reflection.polymorphic?
|
358
|
+
key = reflection.join_foreign_key
|
359
|
+
pkey = reflection.join_primary_key
|
360
|
+
value = value.public_send(pkey) if value.respond_to?(pkey)
|
348
361
|
end
|
349
|
-
end
|
350
362
|
|
351
|
-
|
363
|
+
if !columns_hash.key?(key) || StatementCache.unsupported_value?(value)
|
364
|
+
return super
|
365
|
+
end
|
366
|
+
|
367
|
+
h[key] = value
|
368
|
+
end
|
352
369
|
|
370
|
+
keys = hash.keys
|
353
371
|
statement = cached_find_by_statement(keys) { |params|
|
354
372
|
wheres = keys.index_with { params.bind }
|
355
373
|
where(wheres).limit(1)
|
356
374
|
}
|
357
375
|
|
358
376
|
begin
|
359
|
-
statement.execute(values, connection).first
|
377
|
+
statement.execute(hash.values, connection).first
|
360
378
|
rescue TypeError
|
361
379
|
raise ActiveRecord::StatementInvalid
|
362
380
|
end
|
@@ -42,7 +42,7 @@ module ActiveRecord
|
|
42
42
|
# Return a Hash that can be merged into the main config that represents
|
43
43
|
# the passed in url
|
44
44
|
def build_url_hash
|
45
|
-
if url.nil? || url.start_with?(
|
45
|
+
if url.nil? || %w(jdbc: http: https:).any? { |protocol| url.start_with?(protocol) }
|
46
46
|
{ url: url }
|
47
47
|
else
|
48
48
|
ConnectionUrlResolver.new(url).to_hash
|
data/lib/active_record/enum.rb
CHANGED
@@ -187,27 +187,33 @@ module ActiveRecord
|
|
187
187
|
|
188
188
|
value_method_names = []
|
189
189
|
_enum_methods_module.module_eval do
|
190
|
-
|
191
|
-
|
190
|
+
prefix = if enum_prefix == true
|
191
|
+
"#{name}_"
|
192
|
+
elsif enum_prefix
|
193
|
+
"#{enum_prefix}_"
|
194
|
+
end
|
192
195
|
|
193
|
-
|
194
|
-
|
196
|
+
suffix = if enum_suffix == true
|
197
|
+
"_#{name}"
|
198
|
+
elsif enum_suffix
|
199
|
+
"_#{enum_suffix}"
|
200
|
+
end
|
195
201
|
|
196
202
|
pairs = values.respond_to?(:each_pair) ? values.each_pair : values.each_with_index
|
197
203
|
pairs.each do |label, value|
|
198
|
-
label = label.to_s
|
199
204
|
enum_values[label] = value
|
205
|
+
label = label.to_s
|
200
206
|
|
201
207
|
value_method_name = "#{prefix}#{label}#{suffix}"
|
202
208
|
value_method_names << value_method_name
|
203
|
-
define_enum_methods(name, value_method_name,
|
209
|
+
define_enum_methods(name, value_method_name, value, enum_scopes)
|
204
210
|
|
205
211
|
method_friendly_label = label.gsub(/[\W&&[:ascii:]]+/, "_")
|
206
212
|
value_method_alias = "#{prefix}#{method_friendly_label}#{suffix}"
|
207
213
|
|
208
214
|
if value_method_alias != value_method_name && !value_method_names.include?(value_method_alias)
|
209
215
|
value_method_names << value_method_alias
|
210
|
-
define_enum_methods(name, value_method_alias,
|
216
|
+
define_enum_methods(name, value_method_alias, value, enum_scopes)
|
211
217
|
end
|
212
218
|
end
|
213
219
|
end
|
@@ -225,23 +231,23 @@ module ActiveRecord
|
|
225
231
|
private
|
226
232
|
attr_reader :klass
|
227
233
|
|
228
|
-
def define_enum_methods(name, value_method_name,
|
229
|
-
# def active?()
|
234
|
+
def define_enum_methods(name, value_method_name, value, enum_scopes)
|
235
|
+
# def active?() status_for_database == 0 end
|
230
236
|
klass.send(:detect_enum_conflict!, name, "#{value_method_name}?")
|
231
|
-
define_method("#{value_method_name}?") {
|
237
|
+
define_method("#{value_method_name}?") { public_send(:"#{name}_for_database") == value }
|
232
238
|
|
233
239
|
# def active!() update!(status: 0) end
|
234
240
|
klass.send(:detect_enum_conflict!, name, "#{value_method_name}!")
|
235
|
-
define_method("#{value_method_name}!") { update!(name =>
|
241
|
+
define_method("#{value_method_name}!") { update!(name => value) }
|
236
242
|
|
237
243
|
# scope :active, -> { where(status: 0) }
|
238
244
|
# scope :not_active, -> { where.not(status: 0) }
|
239
245
|
if enum_scopes != false
|
240
246
|
klass.send(:detect_enum_conflict!, name, value_method_name, true)
|
241
|
-
klass.scope value_method_name, -> { where(name =>
|
247
|
+
klass.scope value_method_name, -> { where(name => value) }
|
242
248
|
|
243
249
|
klass.send(:detect_enum_conflict!, name, "not_#{value_method_name}", true)
|
244
|
-
klass.scope "not_#{value_method_name}", -> { where.not(name =>
|
250
|
+
klass.scope "not_#{value_method_name}", -> { where.not(name => value) }
|
245
251
|
end
|
246
252
|
end
|
247
253
|
end
|
@@ -181,7 +181,7 @@ module ActiveRecord
|
|
181
181
|
# end
|
182
182
|
# end
|
183
183
|
#
|
184
|
-
# If you preload your test database with all fixture data (probably by running
|
184
|
+
# If you preload your test database with all fixture data (probably by running <tt>bin/rails db:fixtures:load</tt>)
|
185
185
|
# and use transactional tests, then you may omit all fixtures declarations in your test cases since
|
186
186
|
# all the data's already there and every case rolls back its changes.
|
187
187
|
#
|
@@ -89,7 +89,9 @@ module ActiveRecord
|
|
89
89
|
|
90
90
|
begin
|
91
91
|
locking_column = self.class.locking_column
|
92
|
-
|
92
|
+
lock_attribute_was = @attributes[locking_column]
|
93
|
+
lock_value_for_database = _lock_value_for_database(locking_column)
|
94
|
+
|
93
95
|
attribute_names = attribute_names.dup if attribute_names.frozen?
|
94
96
|
attribute_names << locking_column
|
95
97
|
|
@@ -98,7 +100,7 @@ module ActiveRecord
|
|
98
100
|
affected_rows = self.class._update_record(
|
99
101
|
attributes_with_values(attribute_names),
|
100
102
|
@primary_key => id_in_database,
|
101
|
-
locking_column =>
|
103
|
+
locking_column => lock_value_for_database
|
102
104
|
)
|
103
105
|
|
104
106
|
if affected_rows != 1
|
@@ -109,7 +111,7 @@ module ActiveRecord
|
|
109
111
|
|
110
112
|
# If something went wrong, revert the locking_column value.
|
111
113
|
rescue Exception
|
112
|
-
|
114
|
+
@attributes[locking_column] = lock_attribute_was
|
113
115
|
raise
|
114
116
|
end
|
115
117
|
end
|
@@ -121,7 +123,7 @@ module ActiveRecord
|
|
121
123
|
|
122
124
|
affected_rows = self.class._delete_record(
|
123
125
|
@primary_key => id_in_database,
|
124
|
-
locking_column =>
|
126
|
+
locking_column => _lock_value_for_database(locking_column)
|
125
127
|
)
|
126
128
|
|
127
129
|
if affected_rows != 1
|
@@ -131,6 +133,14 @@ module ActiveRecord
|
|
131
133
|
affected_rows
|
132
134
|
end
|
133
135
|
|
136
|
+
def _lock_value_for_database(locking_column)
|
137
|
+
if will_save_change_to_attribute?(locking_column)
|
138
|
+
@attributes[locking_column].value_for_database
|
139
|
+
else
|
140
|
+
@attributes[locking_column].original_value_for_database
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
134
144
|
module ClassMethods
|
135
145
|
DEFAULT_LOCKING_COLUMN = "lock_version"
|
136
146
|
|
@@ -22,9 +22,10 @@ module ActiveRecord
|
|
22
22
|
def strict_loading_violation(event)
|
23
23
|
debug do
|
24
24
|
owner = event.payload[:owner]
|
25
|
-
association = event.payload[:
|
25
|
+
association = event.payload[:reflection].klass
|
26
|
+
name = event.payload[:reflection].name
|
26
27
|
|
27
|
-
color("Strict loading violation: #{
|
28
|
+
color("Strict loading violation: #{owner} is marked for strict loading. The #{association} association named :#{name} cannot be lazily loaded.", RED)
|
28
29
|
end
|
29
30
|
end
|
30
31
|
|
@@ -320,7 +320,7 @@ module ActiveRecord
|
|
320
320
|
# +table_name+. Passing a hash containing <tt>:from</tt> and <tt>:to</tt>
|
321
321
|
# as +default_or_changes+ will make this change reversible in the migration.
|
322
322
|
# * <tt>change_column_null(table_name, column_name, null, default = nil)</tt>:
|
323
|
-
# Sets or removes a
|
323
|
+
# Sets or removes a <tt>NOT NULL</tt> constraint on +column_name+. The +null+ flag
|
324
324
|
# indicates whether the value can be +NULL+. See
|
325
325
|
# ActiveRecord::ConnectionAdapters::SchemaStatements#change_column_null for
|
326
326
|
# details.
|
@@ -122,9 +122,9 @@ module ActiveRecord
|
|
122
122
|
# :singleton-method: immutable_strings_by_default=
|
123
123
|
# :call-seq: immutable_strings_by_default=(bool)
|
124
124
|
#
|
125
|
-
# Determines whether columns should infer their type as
|
126
|
-
#
|
127
|
-
#
|
125
|
+
# Determines whether columns should infer their type as +:string+ or
|
126
|
+
# +:immutable_string+. This setting does not affect the behavior of
|
127
|
+
# <tt>attribute :foo, :string</tt>. Defaults to false.
|
128
128
|
|
129
129
|
included do
|
130
130
|
mattr_accessor :primary_key_prefix_type, instance_writer: false
|
@@ -316,7 +316,7 @@ module ActiveRecord
|
|
316
316
|
# self.ignored_columns = [:category]
|
317
317
|
# end
|
318
318
|
#
|
319
|
-
# The schema still contains
|
319
|
+
# The schema still contains "category", but now the model omits it, so any meta-driven code or
|
320
320
|
# schema caching will not attempt to use the column:
|
321
321
|
#
|
322
322
|
# Project.columns_hash["category"] => nil
|
@@ -1,7 +1,5 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
ActiveRecord::
|
4
|
-
|
5
|
-
at_exit do
|
6
|
-
ActiveRecord::Base.connection.rollback_transaction
|
3
|
+
ActiveRecord::ConnectionAdapters::AbstractAdapter.set_callback(:checkout, :after) do
|
4
|
+
begin_transaction(joinable: false)
|
7
5
|
end
|
@@ -162,7 +162,7 @@ module ActiveRecord
|
|
162
162
|
# <tt>composed_of :balance, class_name: 'Money'</tt> returns <tt>'Money'</tt>
|
163
163
|
# <tt>has_many :clients</tt> returns <tt>'Client'</tt>
|
164
164
|
def class_name
|
165
|
-
@class_name ||= -(options[:class_name]
|
165
|
+
@class_name ||= -(options[:class_name] || derive_class_name).to_s
|
166
166
|
end
|
167
167
|
|
168
168
|
# Returns a list of scopes that should be applied for this Reflection
|
@@ -683,8 +683,7 @@ module ActiveRecord
|
|
683
683
|
end
|
684
684
|
|
685
685
|
def scope_for_create
|
686
|
-
hash =
|
687
|
-
hash.delete(klass.inheritance_column) if klass.finder_needs_type_condition?
|
686
|
+
hash = where_clause.to_h(klass.table_name, equality_only: true)
|
688
687
|
create_with_value.each { |k, v| hash[k.to_s] = v } unless create_with_value.empty?
|
689
688
|
hash
|
690
689
|
end
|
@@ -326,7 +326,7 @@ module ActiveRecord
|
|
326
326
|
# compared to the records in memory. If the relation is unloaded, an
|
327
327
|
# efficient existence query is performed, as in #exists?.
|
328
328
|
def include?(record)
|
329
|
-
if loaded? || offset_value || limit_value
|
329
|
+
if loaded? || offset_value || limit_value || having_clause.any?
|
330
330
|
records.include?(record)
|
331
331
|
else
|
332
332
|
record.is_a?(klass) && exists?(record.id)
|
@@ -103,7 +103,9 @@ module ActiveRecord
|
|
103
103
|
|
104
104
|
klass ||= AssociationQueryValue
|
105
105
|
queries = klass.new(associated_table, value).queries.map! do |query|
|
106
|
-
|
106
|
+
# If the query produced is identical to attributes don't go any deeper.
|
107
|
+
# Prevents stack level too deep errors when association and foreign_key are identical.
|
108
|
+
query == attributes ? self[key, value] : expand_from_hash(query)
|
107
109
|
end
|
108
110
|
|
109
111
|
grouping_queries(queries)
|
@@ -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
|
|
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
|
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: 2021-
|
11
|
+
date: 2021-02-17 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
|
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
|
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
|
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
|
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/activerecord/CHANGELOG.md
|
394
|
+
documentation_uri: https://api.rubyonrails.org/v6.1.3/
|
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/activerecord
|
397
397
|
post_install_message:
|
398
398
|
rdoc_options:
|
399
399
|
- "--main"
|