activerecord 6.0.1 → 6.0.2

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: cd066bb5f36431ba8c01e43583145bfc944a55a7111cb2d9d53b64a1d2c68122
4
+ data.tar.gz: 567fcfaf568001b64de89198d5879feabb0e1fa623b563dee7ac0e1a74019220
5
5
  SHA512:
6
- metadata.gz: 5ae5468a2a52b707a9f111b1f416d6d3a63ebbfe1658f29f2d64062bbd0cd5408e7b620a4da8cabd8000ea484bbeecd2c70ecb36a94c9a2f91afac32a032ee73
7
- data.tar.gz: 455c884ff4d115d562aa05df54beda3aea735b6b3fb0e29202280eca45fe9f4fad6d2b34a033fd6175048286fadd3ec90a975b02c54653f5a93fd9ac4a8f2d0b
6
+ metadata.gz: 53616ab7035f58aed77d710bf6391bb128bd8dab73e826d15f65685be872e2a0926a525b9be38b48f446684f58496b199a8721d9141051066b7644a5a41aa7c1
7
+ data.tar.gz: ea93e2b7e117fc2516173ca26ac8712af7f47e0d0b895e8bfd9063b66199f07cfb9c84ea0b12afafe0bd71b66168ca40e280e8152fabbecc82068d14c976b104
@@ -1,3 +1,43 @@
1
+ ## Rails 6.0.2 (December 13, 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 collection.
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!
@@ -9,7 +9,7 @@ module ActiveRecord
9
9
  module VERSION
10
10
  MAJOR = 6
11
11
  MINOR = 0
12
- TINY = 1
12
+ TINY = 2
13
13
  PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
@@ -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
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-12-13 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
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
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
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
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/activerecord/CHANGELOG.md
394
+ documentation_uri: https://api.rubyonrails.org/v6.0.2/
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/activerecord
397
397
  post_install_message:
398
398
  rdoc_options:
399
399
  - "--main"