activerecord 8.0.0.rc2 → 8.0.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: 5b6b5ce7951d63889da24f22f9635d27371d6fc733e400d1510cd0ffe27f669e
4
- data.tar.gz: 68f851f76e82b3969bc3a7125b3700ce3623ed7cf1717064f26202b4a5c062cd
3
+ metadata.gz: fdca074c8ca76d0768b2989fb21aaafa5c31f3b80ce1d22275ccfd9d88dd6910
4
+ data.tar.gz: a282424df2605d4c5239f8eedbeb129fe4190e387e7da03292b6ad13e8b2e0ef
5
5
  SHA512:
6
- metadata.gz: ef1e91d706ec3c79e71b2e59780a831a63fe82ab45a8e123748c5d073bc120c3d9506d3e8b43b68aa77dc90a5f564b8ef45cb1d5abc19e008127757966bf32dc
7
- data.tar.gz: 35e7644e3037334b724042c5f26539c2489c579fede36d461e3661cf04ca79b5c8ca0b3e3c29d8edfc9eab3de15af0b8dcee33a7d88f2f4985c46acfce26a324
6
+ metadata.gz: f636c65b58ab040b9d820854f97f16df201d08142e50c609bb6acbd1f4817d55c2eeeb3859541c9b26ec47c48b20e01a7ec4e5736a68e6c8ce8d4ecb6342d39a
7
+ data.tar.gz: 7768bdbf0ff1b8dc3c369fc3168c0c66a56fcf21c00502043f846b1531a8e5962067987e33e43015172a8f346829362598838df197f5fa59f02ed44e9cb6a583
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## Rails 8.0.0 (November 07, 2024) ##
2
+
3
+ * Fix support for `query_cache: false` in `database.yml`.
4
+
5
+ `query_cache: false` would no longer entirely disable the Active Record query cache.
6
+
7
+ *zzak*
8
+
1
9
  ## Rails 8.0.0.rc2 (October 30, 2024) ##
2
10
 
3
11
  * NULLS NOT DISTINCT works with UNIQUE CONSTRAINT as well as UNIQUE INDEX.
@@ -84,7 +84,7 @@ module ActiveRecord
84
84
  attribute_method_patterns_cache.clear
85
85
  end
86
86
 
87
- def alias_attribute_method_definition(code_generator, pattern, new_name, old_name)
87
+ def alias_attribute_method_definition(code_generator, pattern, new_name, old_name) # :nodoc:
88
88
  old_name = old_name.to_s
89
89
 
90
90
  if !abstract_class? && !has_attribute?(old_name)
@@ -674,7 +674,7 @@ module ActiveRecord
674
674
  raise AsynchronousQueryInsideTransactionError, "Asynchronous queries are not allowed inside transactions"
675
675
  end
676
676
 
677
- # We make sure to run query transformers on the orignal thread
677
+ # We make sure to run query transformers on the original thread
678
678
  sql = preprocess_query(sql)
679
679
  future_result = async.new(
680
680
  pool,
@@ -10,7 +10,7 @@ module ActiveRecord
10
10
  MAJOR = 8
11
11
  MINOR = 0
12
12
  TINY = 0
13
- PRE = "rc2"
13
+ PRE = nil
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -240,7 +240,7 @@ module ActiveRecord
240
240
 
241
241
  values_list = insert_all.map_key_with_value do |key, value|
242
242
  next value if Arel::Nodes::SqlLiteral === value
243
- types[key].serialize(types[key].cast(value))
243
+ ActiveModel::Type::SerializeCastValue.serialize(type = types[key], type.cast(value))
244
244
  end
245
245
 
246
246
  connection.visitor.compile(Arel::Nodes::ValuesList.new(values_list))
@@ -930,7 +930,7 @@ module ActiveRecord
930
930
  )
931
931
 
932
932
  returning_columns.zip(returning_values).each do |column, value|
933
- _write_attribute(column, value) if !_read_attribute(column)
933
+ _write_attribute(column, type_for_attribute(column).deserialize(value)) if !_read_attribute(column)
934
934
  end if returning_values
935
935
  end
936
936
 
@@ -35,7 +35,10 @@ module ActiveRecord
35
35
  end
36
36
 
37
37
  def self.run
38
- ActiveRecord::Base.connection_handler.each_connection_pool.reject(&:query_cache_enabled).each(&:enable_query_cache!)
38
+ ActiveRecord::Base.connection_handler.each_connection_pool.reject(&:query_cache_enabled).each do |pool|
39
+ next if pool.db_config&.query_cache == false
40
+ pool.enable_query_cache!
41
+ end
39
42
  end
40
43
 
41
44
  def self.complete(pools)
@@ -1914,8 +1914,6 @@ module ActiveRecord
1914
1914
  return if with_values.empty?
1915
1915
 
1916
1916
  with_statements = with_values.map do |with_value|
1917
- raise ArgumentError, "Unsupported argument type: #{with_value} #{with_value.class}" unless with_value.is_a?(Hash)
1918
-
1919
1917
  build_with_value_from_hash(with_value)
1920
1918
  end
1921
1919
 
@@ -1966,10 +1964,10 @@ module ActiveRecord
1966
1964
  table_name = table_name.name if table_name.is_a?(Symbol)
1967
1965
  case columns
1968
1966
  when Symbol, String
1969
- arel_column_with_table(table_name, columns.to_s)
1967
+ arel_column_with_table(table_name, columns)
1970
1968
  when Array
1971
1969
  columns.map do |column|
1972
- arel_column_with_table(table_name, column.to_s)
1970
+ arel_column_with_table(table_name, column)
1973
1971
  end
1974
1972
  else
1975
1973
  raise TypeError, "Expected Symbol, String or Array, got: #{columns.class}"
@@ -1979,8 +1977,13 @@ module ActiveRecord
1979
1977
 
1980
1978
  def arel_column_with_table(table_name, column_name)
1981
1979
  self.references_values |= [Arel.sql(table_name, retryable: true)]
1982
- predicate_builder.resolve_arel_attribute(table_name, column_name) do
1983
- lookup_table_klass_from_join_dependencies(table_name)
1980
+
1981
+ if column_name.is_a?(Symbol) || !column_name.match?(/\W/)
1982
+ predicate_builder.resolve_arel_attribute(table_name, column_name) do
1983
+ lookup_table_klass_from_join_dependencies(table_name)
1984
+ end
1985
+ else
1986
+ Arel.sql("#{model.adapter_class.quote_table_name(table_name)}.#{column_name}")
1984
1987
  end
1985
1988
  end
1986
1989
 
@@ -1996,6 +1999,8 @@ module ActiveRecord
1996
1999
  arel_column_with_table(table, column)
1997
2000
  elsif block_given?
1998
2001
  yield field
2002
+ elsif Arel.arel_node?(field)
2003
+ field
1999
2004
  else
2000
2005
  Arel.sql(is_symbol ? model.adapter_class.quote_table_name(field) : field)
2001
2006
  end
@@ -2138,7 +2143,7 @@ module ActiveRecord
2138
2143
  arg.expr.relation.name
2139
2144
  end
2140
2145
  end
2141
- end.compact
2146
+ end.filter_map { |ref| Arel.sql(ref, retryable: true) if ref }
2142
2147
  end
2143
2148
 
2144
2149
  def extract_table_name_from(string)
@@ -2232,12 +2237,12 @@ module ActiveRecord
2232
2237
  case columns_aliases
2233
2238
  when Hash
2234
2239
  columns_aliases.map do |column, column_alias|
2235
- arel_column_with_table(table_name, column.to_s)
2240
+ arel_column_with_table(table_name, column)
2236
2241
  .as(model.adapter_class.quote_column_name(column_alias.to_s))
2237
2242
  end
2238
2243
  when Array
2239
2244
  columns_aliases.map do |column|
2240
- arel_column_with_table(table_name, column.to_s)
2245
+ arel_column_with_table(table_name, column)
2241
2246
  end
2242
2247
  when String, Symbol
2243
2248
  arel_column(key)
@@ -2248,6 +2253,7 @@ module ActiveRecord
2248
2253
 
2249
2254
  def process_with_args(args)
2250
2255
  args.flat_map do |arg|
2256
+ raise ArgumentError, "Unsupported argument type: #{arg} #{arg.class}" unless arg.is_a?(Hash)
2251
2257
  arg.map { |k, v| { k => v } }
2252
2258
  end
2253
2259
  end
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: 8.0.0.rc2
4
+ version: 8.0.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: 2024-10-30 00:00:00.000000000 Z
11
+ date: 2024-11-07 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: 8.0.0.rc2
19
+ version: 8.0.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: 8.0.0.rc2
26
+ version: 8.0.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: 8.0.0.rc2
33
+ version: 8.0.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: 8.0.0.rc2
40
+ version: 8.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: timeout
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -475,10 +475,10 @@ licenses:
475
475
  - MIT
476
476
  metadata:
477
477
  bug_tracker_uri: https://github.com/rails/rails/issues
478
- changelog_uri: https://github.com/rails/rails/blob/v8.0.0.rc2/activerecord/CHANGELOG.md
479
- documentation_uri: https://api.rubyonrails.org/v8.0.0.rc2/
478
+ changelog_uri: https://github.com/rails/rails/blob/v8.0.0/activerecord/CHANGELOG.md
479
+ documentation_uri: https://api.rubyonrails.org/v8.0.0/
480
480
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
481
- source_code_uri: https://github.com/rails/rails/tree/v8.0.0.rc2/activerecord
481
+ source_code_uri: https://github.com/rails/rails/tree/v8.0.0/activerecord
482
482
  rubygems_mfa_required: 'true'
483
483
  post_install_message:
484
484
  rdoc_options:
@@ -497,7 +497,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
497
497
  - !ruby/object:Gem::Version
498
498
  version: '0'
499
499
  requirements: []
500
- rubygems_version: 3.5.16
500
+ rubygems_version: 3.5.22
501
501
  signing_key:
502
502
  specification_version: 4
503
503
  summary: Object-relational mapper framework (part of Rails).