activerecord 7.1.0.rc2 → 7.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 105b6eb9b1f55cf060da5abef79eff897bc6cc4ffae4213d00bb60919716de1d
4
- data.tar.gz: b2001af69a5d854f66b1f3fd5fc3b2b96161e3185c1b0d11bbcfa606a0a8e3cf
3
+ metadata.gz: 8c1c4576a55f62b03c5c65f85726c7a054dcf2265c0596ab2b836366f70de537
4
+ data.tar.gz: 8e1a2827cfc53bef1deaba5901134b589bac138711e37ac34fcf95254372b875
5
5
  SHA512:
6
- metadata.gz: a65041e41aa694c421cb83cc41969088ec8c08f5d839fe87b7d9b43c91de2b72d3adb7419858e88fe711654d98b06bf9dad4d8bd6375f4370ff5e40e92782ffb
7
- data.tar.gz: 5b821a9ab05cd006337411118066eaf3e46219d8969a414406919a9725927b95e51d70f79d2723e165db58e93417354a697420c531cc53d435b8dd8405d502b1
6
+ metadata.gz: 13a36c3bbd80622c3a266fd79883baa35dec93e3624d92718cc0fa56f6f4c23dfab83e6fd702e4a8e35b6e4a6f2e81fcc24f8c9e7a71c8d9e791f71bccb9536e
7
+ data.tar.gz: 0b132373d4dda124cc61707c5cd9e08e5cabb68815ed8650de2250becc5d0856610b3622a0d18434bd5182d84cf31fb6b20117d5b0d8ef28ef7698fdcfcc28b4
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## Rails 7.1.0 (October 05, 2023) ##
2
+
3
+ * No changes.
4
+
5
+
1
6
  ## Rails 7.1.0.rc2 (October 01, 2023) ##
2
7
 
3
8
  * Remove -shm and -wal SQLite files when `rails db:drop` is run.
@@ -75,7 +75,7 @@ module ActiveRecord
75
75
  # for an Author.
76
76
  # - an Array which specifies multiple association names. This array
77
77
  # is processed recursively. For example, specifying <tt>[:avatar, :books]</tt>
78
- # allows this method to preload an author's avatar as well as all of his
78
+ # allows this method to preload an author's avatar as well as all of their
79
79
  # books.
80
80
  # - a Hash which specifies multiple association names, as well as
81
81
  # association names for the to-be-preloaded association objects. For
@@ -82,8 +82,11 @@ module ActiveRecord
82
82
  @base_payload = payload
83
83
  end
84
84
 
85
+ class InstrumentationNotStartedError < ActiveRecordError; end
86
+ class InstrumentationAlreadyStartedError < ActiveRecordError; end
87
+
85
88
  def start
86
- return if @started
89
+ raise InstrumentationAlreadyStartedError.new("Called start on an already started transaction") if @started
87
90
  @started = true
88
91
 
89
92
  @payload = @base_payload.dup
@@ -92,7 +95,7 @@ module ActiveRecord
92
95
  end
93
96
 
94
97
  def finish(outcome)
95
- return unless @started
98
+ raise InstrumentationNotStartedError.new("Called finish on a transaction that hasn't started") unless @started
96
99
  @started = false
97
100
 
98
101
  @payload[:outcome] = outcome
@@ -166,7 +169,7 @@ module ActiveRecord
166
169
  end
167
170
 
168
171
  def incomplete!
169
- @instrumenter.finish(:incomplete)
172
+ @instrumenter.finish(:incomplete) if materialized?
170
173
  end
171
174
 
172
175
  def materialize!
@@ -180,6 +183,7 @@ module ActiveRecord
180
183
 
181
184
  def restore!
182
185
  if materialized?
186
+ incomplete!
183
187
  @materialized = false
184
188
  materialize!
185
189
  end
@@ -348,13 +352,13 @@ module ActiveRecord
348
352
  connection.rollback_to_savepoint(savepoint_name) if materialized?
349
353
  end
350
354
  @state.rollback!
351
- @instrumenter.finish(:rollback)
355
+ @instrumenter.finish(:rollback) if materialized?
352
356
  end
353
357
 
354
358
  def commit
355
359
  connection.release_savepoint(savepoint_name) if materialized?
356
360
  @state.commit!
357
- @instrumenter.finish(:commit)
361
+ @instrumenter.finish(:commit) if materialized?
358
362
  end
359
363
 
360
364
  def full_rollback?; false; end
@@ -389,13 +393,13 @@ module ActiveRecord
389
393
  def rollback
390
394
  connection.rollback_db_transaction if materialized?
391
395
  @state.full_rollback!
392
- @instrumenter.finish(:rollback)
396
+ @instrumenter.finish(:rollback) if materialized?
393
397
  end
394
398
 
395
399
  def commit
396
400
  connection.commit_db_transaction if materialized?
397
401
  @state.full_commit!
398
- @instrumenter.finish(:commit)
402
+ @instrumenter.finish(:commit) if materialized?
399
403
  end
400
404
  end
401
405
 
@@ -149,6 +149,7 @@ module ActiveRecord
149
149
  end
150
150
 
151
151
  def lookup_cast_type_from_column(column) # :nodoc:
152
+ verify! if type_map.nil?
152
153
  type_map.lookup(column.oid, column.fmod, column.sql_type)
153
154
  end
154
155
 
@@ -716,9 +716,7 @@ module ActiveRecord
716
716
  end
717
717
 
718
718
  private
719
- def type_map
720
- @type_map ||= Type::HashLookupTypeMap.new
721
- end
719
+ attr_reader :type_map
722
720
 
723
721
  def initialize_type_map(m = type_map)
724
722
  self.class.initialize_type_map(m)
@@ -10,7 +10,7 @@ module ActiveRecord
10
10
  MAJOR = 7
11
11
  MINOR = 1
12
12
  TINY = 0
13
- PRE = "rc2"
13
+ PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -553,6 +553,20 @@ module ActiveRecord
553
553
  initialize_find_by_cache
554
554
  end
555
555
 
556
+ def load_schema # :nodoc:
557
+ return if schema_loaded?
558
+ @load_schema_monitor.synchronize do
559
+ return if @columns_hash
560
+
561
+ load_schema!
562
+
563
+ @schema_loaded = true
564
+ rescue
565
+ reload_schema_from_cache # If the schema loading failed half way through, we must reset the state.
566
+ raise
567
+ end
568
+ end
569
+
556
570
  protected
557
571
  def initialize_load_schema_monitor
558
572
  @load_schema_monitor = Monitor.new
@@ -594,20 +608,6 @@ module ActiveRecord
594
608
  defined?(@schema_loaded) && @schema_loaded
595
609
  end
596
610
 
597
- def load_schema
598
- return if schema_loaded?
599
- @load_schema_monitor.synchronize do
600
- return if @columns_hash
601
-
602
- load_schema!
603
-
604
- @schema_loaded = true
605
- rescue
606
- reload_schema_from_cache # If the schema loading failed half way through, we must reset the state.
607
- raise
608
- end
609
- end
610
-
611
611
  def load_schema!
612
612
  unless table_name
613
613
  raise ActiveRecord::TableNotSpecified, "#{self} has no table configured. Set one with #{self}.table_name="
@@ -87,7 +87,7 @@ module ActiveRecord
87
87
  klass.connection.schema_cache.indexes(klass.table_name).any? do |index|
88
88
  index.unique &&
89
89
  index.where.nil? &&
90
- (index.columns - attributes).empty?
90
+ (Array(index.columns) - attributes).empty?
91
91
  end
92
92
  end
93
93
 
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: 7.1.0.rc2
4
+ version: 7.1.0
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: 2023-10-01 00:00:00.000000000 Z
11
+ date: 2023-10-05 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: 7.1.0.rc2
19
+ version: 7.1.0
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: 7.1.0.rc2
26
+ version: 7.1.0
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: 7.1.0.rc2
33
+ version: 7.1.0
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: 7.1.0.rc2
40
+ version: 7.1.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: timeout
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -469,10 +469,10 @@ licenses:
469
469
  - MIT
470
470
  metadata:
471
471
  bug_tracker_uri: https://github.com/rails/rails/issues
472
- changelog_uri: https://github.com/rails/rails/blob/v7.1.0.rc2/activerecord/CHANGELOG.md
473
- documentation_uri: https://api.rubyonrails.org/v7.1.0.rc2/
472
+ changelog_uri: https://github.com/rails/rails/blob/v7.1.0/activerecord/CHANGELOG.md
473
+ documentation_uri: https://api.rubyonrails.org/v7.1.0/
474
474
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
475
- source_code_uri: https://github.com/rails/rails/tree/v7.1.0.rc2/activerecord
475
+ source_code_uri: https://github.com/rails/rails/tree/v7.1.0/activerecord
476
476
  rubygems_mfa_required: 'true'
477
477
  post_install_message:
478
478
  rdoc_options:
@@ -487,9 +487,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
487
487
  version: 2.7.0
488
488
  required_rubygems_version: !ruby/object:Gem::Requirement
489
489
  requirements:
490
- - - ">"
490
+ - - ">="
491
491
  - !ruby/object:Gem::Version
492
- version: 1.3.1
492
+ version: '0'
493
493
  requirements: []
494
494
  rubygems_version: 3.4.18
495
495
  signing_key: