activerecord 6.0.1 → 6.0.2.rc1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 74e749ea0406c6090f479a06ed90ab6d7be8a341b3662329c623d212652ef0d3
4
- data.tar.gz: 9daac4d5a5f794386f5580724c8a9f27c9a42c3db561d5a37ec314ac5715f0f8
3
+ metadata.gz: 458c4f148157e395ef92a5830397087711428bdb229ca9eea60cd405eec3af13
4
+ data.tar.gz: 940647c02f001e722bf339d93faf088f64747eb3c22be454a30dbec897cf136a
5
5
  SHA512:
6
- metadata.gz: 5ae5468a2a52b707a9f111b1f416d6d3a63ebbfe1658f29f2d64062bbd0cd5408e7b620a4da8cabd8000ea484bbeecd2c70ecb36a94c9a2f91afac32a032ee73
7
- data.tar.gz: 455c884ff4d115d562aa05df54beda3aea735b6b3fb0e29202280eca45fe9f4fad6d2b34a033fd6175048286fadd3ec90a975b02c54653f5a93fd9ac4a8f2d0b
6
+ metadata.gz: aed3b17f1ba36e57cac853c10e0c6f8ca43c2bbfb00acf58fcc73397e89ee4bca17513ae31ad76e35c06c98fc7e477a41095a3a0dd58febf93179d03db4fe9f3
7
+ data.tar.gz: 3bf1aa4541ca63aeb46c499a357f93a79d9b060e15360e6b15a93e70d68616716ece4529499cc970c9799166464ff2f14630ab030b9db5ef708a4f0295499dda
@@ -1,3 +1,43 @@
1
+ ## Rails 6.0.2.rc1 (November 27, 2019) ##
2
+
3
+ * Share the same connection pool for primary and replica databases in the
4
+ transactional tests for the same database.
5
+
6
+ *Edouard Chin*
7
+
8
+ * Fix the preloader when one record is fetched using `after_initialize`
9
+ but not the entire colection.
10
+
11
+ *Bradley Price*
12
+
13
+ * Fix collection callbacks not terminating when `:abort` is thrown.
14
+
15
+ *Edouard Chin*, *Ryuta Kamizono*
16
+
17
+ * Correctly deprecate `where.not` working as NOR for relations.
18
+
19
+ 12a9664 deprecated where.not working as NOR, however
20
+ doing a relation query like `where.not(relation: { ... })`
21
+ wouldn't be properly deprecated and `where.not` would work as
22
+ NAND instead.
23
+
24
+ *Edouard Chin*
25
+
26
+ * Fix `db:migrate` task with multiple databases to restore the connection
27
+ to the previous database.
28
+
29
+ The migrate task iterates and establish a connection over each db
30
+ resulting in the last one to be used by subsequent rake tasks.
31
+ We should reestablish a connection to the connection that was
32
+ established before the migrate tasks was run
33
+
34
+ *Edouard Chin*
35
+
36
+ * Fix multi-threaded issue for `AcceptanceValidator`.
37
+
38
+ *Ryuta Kamizono*
39
+
40
+
1
41
  ## Rails 6.0.1 (November 5, 2019) ##
2
42
 
3
43
  * Common Table Expressions are allowed on read-only connections.
@@ -378,7 +378,9 @@ module ActiveRecord
378
378
  end
379
379
 
380
380
  def remove_records(existing_records, records, method)
381
- records.each { |record| callback(:before_remove, record) }
381
+ catch(:abort) do
382
+ records.each { |record| callback(:before_remove, record) }
383
+ end || return
382
384
 
383
385
  delete_records(existing_records, method) if existing_records.any?
384
386
  @target -= records
@@ -434,7 +436,9 @@ module ActiveRecord
434
436
  end
435
437
 
436
438
  def replace_on_target(record, index, skip_callbacks)
437
- callback(:before_add, record) unless skip_callbacks
439
+ catch(:abort) do
440
+ callback(:before_add, record)
441
+ end || return unless skip_callbacks
438
442
 
439
443
  set_inverse_instance(record)
440
444
 
@@ -185,7 +185,7 @@ module ActiveRecord
185
185
  # and attach it to a relation. The class returned implements a `run` method
186
186
  # that accepts a preloader.
187
187
  def preloader_for(reflection, owners)
188
- if owners.first.association(reflection.name).loaded?
188
+ if owners.all? { |o| o.association(reflection.name).loaded? }
189
189
  return AlreadyLoaded
190
190
  end
191
191
  reflection.check_preloadable!
@@ -85,7 +85,9 @@ module ActiveRecord
85
85
  set_callback :checkin, :after, :enable_lazy_transactions!
86
86
 
87
87
  def self.type_cast_config_to_integer(config)
88
- if config.is_a?(Integer)
88
+ if config.nil?
89
+ config
90
+ elsif config.is_a?(Integer)
89
91
  config
90
92
  elsif SIMPLE_INT.match?(config)
91
93
  config.to_i
@@ -162,7 +162,7 @@ module ActiveRecord
162
162
  type_metadata = fetch_type_metadata(field[:Type], field[:Extra])
163
163
  default, default_function = field[:Default], nil
164
164
 
165
- if type_metadata.type == :datetime && /\ACURRENT_TIMESTAMP(?:\([0-6]?\))?\z/i.match?(default)
165
+ if type_metadata.type == :datetime && default && /\ACURRENT_TIMESTAMP(?:\([0-6]?\))?\z/i.match?(default)
166
166
  default, default_function = nil, default
167
167
  elsif type_metadata.extra == "DEFAULT_GENERATED"
168
168
  default = +"(#{default})" unless default.start_with?("(")
@@ -617,7 +617,7 @@ module ActiveRecord
617
617
  end
618
618
 
619
619
  def has_default_function?(default_value, default)
620
- !default_value && %r{\w+\(.*\)|\(.*\)::\w+|CURRENT_DATE|CURRENT_TIMESTAMP}.match?(default)
620
+ !default_value && default && %r{\w+\(.*\)|\(.*\)::\w+|CURRENT_DATE|CURRENT_TIMESTAMP}.match?(default)
621
621
  end
622
622
 
623
623
  def load_additional_types(oids = nil)
@@ -9,8 +9,8 @@ module ActiveRecord
9
9
  module VERSION
10
10
  MAJOR = 6
11
11
  MINOR = 0
12
- TINY = 1
13
- PRE = nil
12
+ TINY = 2
13
+ PRE = "rc1"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -80,11 +80,14 @@ db_namespace = namespace :db do
80
80
 
81
81
  desc "Migrate the database (options: VERSION=x, VERBOSE=false, SCOPE=blog)."
82
82
  task migrate: :load_config do
83
+ original_config = ActiveRecord::Base.connection_config
83
84
  ActiveRecord::Base.configurations.configs_for(env_name: ActiveRecord::Tasks::DatabaseTasks.env).each do |db_config|
84
85
  ActiveRecord::Base.establish_connection(db_config.config)
85
86
  ActiveRecord::Tasks::DatabaseTasks.migrate
86
87
  end
87
88
  db_namespace["_dump"].invoke
89
+ ensure
90
+ ActiveRecord::Base.establish_connection(original_config)
88
91
  end
89
92
 
90
93
  # IMPORTANT: This task won't dump the schema if ActiveRecord::Base.dump_schema_after_migration is set to false
@@ -52,7 +52,15 @@ module ActiveRecord
52
52
  ActiveSupport::Deprecation.warn(<<~MSG.squish)
53
53
  NOT conditions will no longer behave as NOR in Rails 6.1.
54
54
  To continue using NOR conditions, NOT each conditions manually
55
- (`#{ opts.keys.map { |key| ".where.not(#{key.inspect} => ...)" }.join }`).
55
+ (`#{
56
+ opts.flat_map { |key, value|
57
+ if value.is_a?(Hash) && value.size > 1
58
+ value.map { |k, v| ".where.not(#{key.inspect} => { #{k.inspect} => ... })" }
59
+ else
60
+ ".where.not(#{key.inspect} => ...)"
61
+ end
62
+ }.join
63
+ }`).
56
64
  MSG
57
65
  @scope.where_clause += where_clause.invert(:nor)
58
66
  else
@@ -64,7 +72,10 @@ module ActiveRecord
64
72
 
65
73
  private
66
74
  def not_behaves_as_nor?(opts)
67
- opts.is_a?(Hash) && opts.size > 1
75
+ return false unless opts.is_a?(Hash)
76
+
77
+ opts.any? { |k, v| v.is_a?(Hash) && v.size > 1 } ||
78
+ opts.size > 1
68
79
  end
69
80
  end
70
81
 
@@ -31,7 +31,8 @@ module ActiveRecord
31
31
  ActiveSupport::Deprecation.warn(<<~MSG.squish)
32
32
  Class level methods will no longer inherit scoping from `#{scope._deprecated_scope_source}`
33
33
  in Rails 6.1. To continue using the scoped relation, pass it into the block directly.
34
- To instead access the full set of models, as Rails 6.1 will, use `#{name}.unscoped`.
34
+ To instead access the full set of models, as Rails 6.1 will, use `#{name}.unscoped`,
35
+ or `#{name}.default_scoped` if a model has default scopes.
35
36
  MSG
36
37
  end
37
38
 
@@ -129,6 +129,7 @@ module ActiveRecord
129
129
  # When connections are established in the future, begin a transaction too
130
130
  @connection_subscriber = ActiveSupport::Notifications.subscribe("!connection.active_record") do |_, _, _, _, payload|
131
131
  spec_name = payload[:spec_name] if payload.key?(:spec_name)
132
+ setup_shared_connection_pool
132
133
 
133
134
  if spec_name
134
135
  begin
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.0.1
4
+ version: 6.0.2.rc1
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: 2019-11-05 00:00:00.000000000 Z
11
+ date: 2019-11-27 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.0.1
19
+ version: 6.0.2.rc1
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.0.1
26
+ version: 6.0.2.rc1
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.0.1
33
+ version: 6.0.2.rc1
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.0.1
40
+ version: 6.0.2.rc1
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.0.1/activerecord/CHANGELOG.md
394
- documentation_uri: https://api.rubyonrails.org/v6.0.1/
393
+ changelog_uri: https://github.com/rails/rails/blob/v6.0.2.rc1/activerecord/CHANGELOG.md
394
+ documentation_uri: https://api.rubyonrails.org/v6.0.2.rc1/
395
395
  mailing_list_uri: https://groups.google.com/forum/#!forum/rubyonrails-talk
396
- source_code_uri: https://github.com/rails/rails/tree/v6.0.1/activerecord
396
+ source_code_uri: https://github.com/rails/rails/tree/v6.0.2.rc1/activerecord
397
397
  post_install_message:
398
398
  rdoc_options:
399
399
  - "--main"
@@ -407,9 +407,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
407
407
  version: 2.5.0
408
408
  required_rubygems_version: !ruby/object:Gem::Requirement
409
409
  requirements:
410
- - - ">="
410
+ - - ">"
411
411
  - !ruby/object:Gem::Version
412
- version: '0'
412
+ version: 1.3.1
413
413
  requirements: []
414
414
  rubygems_version: 3.0.3
415
415
  signing_key: