omg-activerecord 8.0.0.alpha8 → 8.0.0.alpha9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cc9fc5fc89b2ab6f07dedbd0819e84a859a9fe8bc4ea2420f10ad2a27fc86ba9
4
- data.tar.gz: 16d5e5c3d177d81f806585dd941409952a3ebcb10671499ea82929649c031b54
3
+ metadata.gz: 6df1d2580bf80503ab39009c815418978bebe5092307657bf220805fbf43f3d8
4
+ data.tar.gz: 59f567f5c898fdecbb8afc2cf065ae5d14f2bf22d26523f672c059c14f8e2216
5
5
  SHA512:
6
- metadata.gz: b6335a7bcbdb8c3328627d684fcd8dec4ae940db8c9f172262e3d31f1704bd78880b848c1e5e51f1cca907a77ece8ba39955b5c2ca1d1a061e529b5609f87a82
7
- data.tar.gz: d1fe94c5deeb975858ae3e912f593ea8fcc10fae2bad543a6514dd8d862e734cbf974fc1e8b696b69e6b3c514e389055467d75250b869c77fb4fe49959069dd4
6
+ metadata.gz: c24ba15aa87ed2f85ea436436a98e92be55f0b8115c61136a5134eba366a7cad9263de1fcd730aa3d32659a2450257cb02e237d2a6db4c685b7d147a4bbdd735
7
+ data.tar.gz: 2a84610c157dba60070937f224332908f3cc6d2ac1a2b6c3b711c8684a38df5b7e756971356801dc6a18bcf4138e4c8b417968ab743cab213bbb3190f68592bd
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## Rails 8.0.0.alpha9 (September 25, 2024) ##
2
+
3
+ * No changes.
4
+
5
+
1
6
  ## Rails 8.0.0.alpha8 (September 18, 2024) ##
2
7
 
3
8
  * No changes.
@@ -157,17 +162,6 @@
157
162
 
158
163
  *Justin Talbott*
159
164
 
160
- * Infer default `:inverse_of` option for `delegated_type` definitions.
161
-
162
- ```ruby
163
- class Entry < ApplicationRecord
164
- delegated_type :entryable, types: %w[ Message ]
165
- # => defaults to inverse_of: :entry
166
- end
167
- ```
168
-
169
- *Sean Doyle*
170
-
171
165
  * Add support for `ActiveRecord::Point` type casts using `Hash` values
172
166
 
173
167
  This allows `ActiveRecord::Point` to be cast or serialized from a hash
@@ -212,8 +212,7 @@ module ActiveRecord
212
212
  #--
213
213
  # Implemented by ActiveModel::AttributeRegistration#attribute.
214
214
 
215
- # This is the low level API which sits beneath +attribute+. It only
216
- # accepts type objects, and will do its work immediately instead of
215
+ # This API only accepts type objects, and will do its work immediately instead of
217
216
  # waiting for the schema to load. While this method
218
217
  # is provided so it can be used by plugin authors, application code
219
218
  # should probably use ClassMethods#attribute.
@@ -157,11 +157,13 @@ module ActiveRecord
157
157
  end
158
158
 
159
159
  def enable_query_cache!
160
- query_cache.enabled, query_cache.dirties = true, true
160
+ query_cache.enabled = true
161
+ query_cache.dirties = true
161
162
  end
162
163
 
163
164
  def disable_query_cache!
164
- query_cache.enabled, query_cache.dirties = false, true
165
+ query_cache.enabled = false
166
+ query_cache.dirties = true
165
167
  end
166
168
 
167
169
  def query_cache_enabled
@@ -855,6 +855,16 @@ module ActiveRecord
855
855
  #
856
856
  # Note: only supported by PostgreSQL.
857
857
  #
858
+ # ====== Creating an index where NULLs are treated equally
859
+ #
860
+ # add_index(:people, :last_name, nulls_not_distinct: true)
861
+ #
862
+ # generates:
863
+ #
864
+ # CREATE INDEX index_people_on_last_name ON people (last_name) NULLS NOT DISTINCT
865
+ #
866
+ # Note: only supported by PostgreSQL version 15.0.0 and greater.
867
+ #
858
868
  # ====== Creating an index with a specific method
859
869
  #
860
870
  # add_index(:developers, :name, using: 'btree')
@@ -11,9 +11,12 @@ require "active_record/connection_adapters/sqlite3/schema_definitions"
11
11
  require "active_record/connection_adapters/sqlite3/schema_dumper"
12
12
  require "active_record/connection_adapters/sqlite3/schema_statements"
13
13
 
14
- gem "sqlite3", ">= 2.0"
14
+ gem "sqlite3", ">= 2.1"
15
15
  require "sqlite3"
16
16
 
17
+ # Suppress the warning that SQLite3 issues when open writable connections are carried across fork()
18
+ SQLite3::ForkSafety.suppress_warnings!
19
+
17
20
  module ActiveRecord
18
21
  module ConnectionAdapters # :nodoc:
19
22
  # = Active Record SQLite3 Adapter
@@ -350,7 +350,7 @@ module ActiveRecord
350
350
 
351
351
  # Returns a string like 'Post(id:integer, title:string, body:text)'
352
352
  def inspect # :nodoc:
353
- if self == Base
353
+ if self == Base || singleton_class?
354
354
  super
355
355
  elsif abstract_class?
356
356
  "#{super}(abstract)"
@@ -220,14 +220,6 @@ module ActiveRecord
220
220
  # [:primary_key]
221
221
  # Specify the method that returns the primary key of associated object used for the convenience methods.
222
222
  # By default this is +id+.
223
- # [+:inverse_of+]
224
- # Specifies the name of the #belongs_to association on the associated object
225
- # that is the inverse of this #has_one association. By default, the class
226
- # singularized class name is used unless a <tt>:foreign_key</tt> option is
227
- # also provided. For example, a call to
228
- # <tt>Entry.delegated_type</tt> will default to <tt>inverse_of: :entry</tt>.
229
- # See ActiveRecord::Associations::ClassMethods's overview on Bi-directional
230
- # associations for more detail.
231
223
  #
232
224
  # Option examples:
233
225
  # class Entry < ApplicationRecord
@@ -237,8 +229,6 @@ module ActiveRecord
237
229
  # Entry#message_uuid # => returns entryable_uuid, when entryable_type == "Message", otherwise nil
238
230
  # Entry#comment_uuid # => returns entryable_uuid, when entryable_type == "Comment", otherwise nil
239
231
  def delegated_type(role, types:, **options)
240
- options[:inverse_of] = model_name.singular unless options.key?(:inverse_of) || options.key?(:foreign_key)
241
-
242
232
  belongs_to role, options.delete(:scope), **options.merge(polymorphic: true)
243
233
  define_delegated_type_methods role, types: types, options: options
244
234
  end
@@ -10,7 +10,7 @@ module ActiveRecord
10
10
  MAJOR = 8
11
11
  MINOR = 0
12
12
  TINY = 0
13
- PRE = "alpha8"
13
+ PRE = "alpha9"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -431,7 +431,6 @@ module ActiveRecord
431
431
  end
432
432
 
433
433
  def columns
434
- load_schema unless @columns
435
434
  @columns ||= columns_hash.values.freeze
436
435
  end
437
436
 
@@ -147,7 +147,7 @@ module ActiveRecord
147
147
  queries.first
148
148
  else
149
149
  queries.map! { |query| query.reduce(&:and) }
150
- queries = queries.reduce { |result, query| Arel::Nodes::Or.new([result, query]) }
150
+ queries = Arel::Nodes::Or.new(queries)
151
151
  Arel::Nodes::Grouping.new(queries)
152
152
  end
153
153
  end
@@ -14,6 +14,7 @@ module ActiveRecord
14
14
  end
15
15
  super
16
16
  @klass = options[:class]
17
+ @klass = @klass.superclass if @klass.singleton_class?
17
18
  end
18
19
 
19
20
  def validate_each(record, attribute, value)
@@ -53,17 +54,17 @@ module ActiveRecord
53
54
  private
54
55
  # The check for an existing value should be run from a class that
55
56
  # isn't abstract. This means working down from the current class
56
- # (self), to the first non-abstract class. Since classes don't know
57
- # their subclasses, we have to build the hierarchy between self and
58
- # the record's class.
57
+ # (self), to the first non-abstract class.
59
58
  def find_finder_class_for(record)
60
- class_hierarchy = [record.class]
61
-
62
- while class_hierarchy.first != @klass
63
- class_hierarchy.unshift(class_hierarchy.first.superclass)
59
+ current_class = record.class
60
+ found_class = nil
61
+ loop do
62
+ found_class = current_class unless current_class.abstract_class?
63
+ break if current_class == @klass
64
+ current_class = current_class.superclass
64
65
  end
65
66
 
66
- class_hierarchy.detect { |klass| !klass.abstract_class? }
67
+ found_class
67
68
  end
68
69
 
69
70
  def validation_needed?(klass, record, attribute)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omg-activerecord
3
3
  version: !ruby/object:Gem::Version
4
- version: 8.0.0.alpha8
4
+ version: 8.0.0.alpha9
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: 2024-09-18 00:00:00.000000000 Z
11
+ date: 2024-09-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omg-activesupport
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 8.0.0.alpha8
19
+ version: 8.0.0.alpha9
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: 8.0.0.alpha8
26
+ version: 8.0.0.alpha9
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: omg-activemodel
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - '='
32
32
  - !ruby/object:Gem::Version
33
- version: 8.0.0.alpha8
33
+ version: 8.0.0.alpha9
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: 8.0.0.alpha8
40
+ version: 8.0.0.alpha9
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: timeout
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -476,10 +476,10 @@ licenses:
476
476
  - MIT
477
477
  metadata:
478
478
  bug_tracker_uri: https://github.com/rails/rails/issues
479
- changelog_uri: https://github.com/rails/rails/blob/v8.0.0.alpha8/activerecord/CHANGELOG.md
480
- documentation_uri: https://api.rubyonrails.org/v8.0.0.alpha8/
479
+ changelog_uri: https://github.com/rails/rails/blob/v8.0.0.alpha9/activerecord/CHANGELOG.md
480
+ documentation_uri: https://api.rubyonrails.org/v8.0.0.alpha9/
481
481
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
482
- source_code_uri: https://github.com/rails/rails/tree/v8.0.0.alpha8/activerecord
482
+ source_code_uri: https://github.com/rails/rails/tree/v8.0.0.alpha9/activerecord
483
483
  rubygems_mfa_required: 'true'
484
484
  post_install_message:
485
485
  rdoc_options: