Script 'mail_helper' called by obssrc
Hello community,
here is the log from the commit of package rubygem-activerecord-7.0 for
openSUSE:Factory checked in at 2022-10-12 18:25:00
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/rubygem-activerecord-7.0 (Old)
and /work/SRC/openSUSE:Factory/.rubygem-activerecord-7.0.new.2275 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "rubygem-activerecord-7.0"
Wed Oct 12 18:25:00 2022 rev:6 rq:1010045 version:7.0.4
Changes:
--------
---
/work/SRC/openSUSE:Factory/rubygem-activerecord-7.0/rubygem-activerecord-7.0.changes
2022-08-06 22:07:51.802605146 +0200
+++
/work/SRC/openSUSE:Factory/.rubygem-activerecord-7.0.new.2275/rubygem-activerecord-7.0.changes
2022-10-12 18:26:44.321960245 +0200
@@ -1,0 +2,104 @@
+Mon Oct 10 12:54:17 UTC 2022 - Stephan Kulow <[email protected]>
+
+updated to version 7.0.4
+ see installed CHANGELOG.md
+
+ ## Rails 7.0.4 (September 09, 2022) ##
+
+ * Symbol is allowed by default for YAML columns
+
+ *??tienne Barri??*
+
+ * Fix `ActiveRecord::Store` to serialize as a regular Hash
+
+ Previously it would serialize as an
`ActiveSupport::HashWithIndifferentAccess`
+ which is wasteful and cause problem with YAML safe_load.
+
+ *Jean Boussier*
+
+ * Add `timestamptz` as a time zone aware type for PostgreSQL
+
+ This is required for correctly parsing `timestamp with time zone` values
in your database.
+
+ If you don't want this, you can opt out by adding this initializer:
+
+ ```ruby
+ ActiveRecord::Base.time_zone_aware_types -= [:timestamptz]
+ ```
+
+ *Alex Ghiculescu*
+
+ * Fix supporting timezone awareness for `tsrange` and `tstzrange` array
columns.
+
+ ```ruby
+ # In database migrations
+ add_column :shops, :open_hours, :tsrange, array: true
+ # In app config
+ ActiveRecord::Base.time_zone_aware_types += [:tsrange]
+ # In the code times are properly converted to app time zone
+ Shop.create!(open_hours: [Time.current..8.hour.from_now])
+ ```
+
+ *Wojciech Wn??trzak*
+
+ * Resolve issue where a relation cache_version could be left stale.
+
+ Previously, when `reset` was called on a relation object it did not
reset the cache_versions
+ ivar. This led to a confusing situation where despite having the correct
data the relation
+ still reported a stale cache_version.
+
+ Usage:
+
+ ```ruby
+ developers = Developer.all
+ developers.cache_version
+
+ Developer.update_all(updated_at: Time.now.utc + 1.second)
+
+ developers.cache_version # Stale cache_version
+ developers.reset
+ developers.cache_version # Returns the current correct cache_version
+ ```
+
+ Fixes #45341.
+
+ *Austen Madden*
+
+ * Fix `load_async` when called on an association proxy.
+
+ Calling `load_async` directly an association would schedule
+ a query but never use it.
+
+ ```ruby
+ comments = post.comments.load_async # schedule a query
+ comments.to_a # perform an entirely new sync query
+ ```
+
+ Now it does use the async query, however note that it doesn't
+ cause the association to be loaded.
+
+ *Jean Boussier*
+
+ * Fix eager loading for models without primary keys.
+
+ *Anmol Chopra*, *Matt Lawrence*, and *Jonathan Hefner*
+
+ * `rails db:schema:{dump,load}` now checks `ENV["SCHEMA_FORMAT"]` before
config
+
+ Since `rails db:structure:{dump,load}` was deprecated there wasn't a
simple
+ way to dump a schema to both SQL and Ruby formats. You can now do this
with
+ an environment variable. For example:
+
+ ```
+ SCHEMA_FORMAT=sql rake db:schema:dump
+ ```
+
+ *Alex Ghiculescu*
+
+ * Fix Hstore deserialize regression.
+
+ *edsharp*
+
+
+
+-------------------------------------------------------------------
Old:
----
activerecord-7.0.3.1.gem
New:
----
activerecord-7.0.4.gem
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ rubygem-activerecord-7.0.spec ++++++
--- /var/tmp/diff_new_pack.IaB0Zm/_old 2022-10-12 18:26:44.733961152 +0200
+++ /var/tmp/diff_new_pack.IaB0Zm/_new 2022-10-12 18:26:44.741961169 +0200
@@ -24,7 +24,7 @@
#
Name: rubygem-activerecord-7.0
-Version: 7.0.3.1
+Version: 7.0.4
Release: 0
%define mod_name activerecord
%define mod_full_name %{mod_name}-%{version}
++++++ activerecord-7.0.3.1.gem -> activerecord-7.0.4.gem ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/CHANGELOG.md new/CHANGELOG.md
--- old/CHANGELOG.md 2022-07-12 19:30:22.000000000 +0200
+++ new/CHANGELOG.md 2022-09-09 20:42:16.000000000 +0200
@@ -1,3 +1,100 @@
+## Rails 7.0.4 (September 09, 2022) ##
+
+* Symbol is allowed by default for YAML columns
+
+ *??tienne Barri??*
+
+* Fix `ActiveRecord::Store` to serialize as a regular Hash
+
+ Previously it would serialize as an
`ActiveSupport::HashWithIndifferentAccess`
+ which is wasteful and cause problem with YAML safe_load.
+
+ *Jean Boussier*
+
+* Add `timestamptz` as a time zone aware type for PostgreSQL
+
+ This is required for correctly parsing `timestamp with time zone` values
in your database.
+
+ If you don't want this, you can opt out by adding this initializer:
+
+ ```ruby
+ ActiveRecord::Base.time_zone_aware_types -= [:timestamptz]
+ ```
+
+ *Alex Ghiculescu*
+
+* Fix supporting timezone awareness for `tsrange` and `tstzrange` array
columns.
+
+ ```ruby
+ # In database migrations
+ add_column :shops, :open_hours, :tsrange, array: true
+ # In app config
+ ActiveRecord::Base.time_zone_aware_types += [:tsrange]
+ # In the code times are properly converted to app time zone
+ Shop.create!(open_hours: [Time.current..8.hour.from_now])
+ ```
+
+ *Wojciech Wn??trzak*
+
+* Resolve issue where a relation cache_version could be left stale.
+
+ Previously, when `reset` was called on a relation object it did not reset
the cache_versions
+ ivar. This led to a confusing situation where despite having the correct
data the relation
+ still reported a stale cache_version.
+
+ Usage:
+
+ ```ruby
+ developers = Developer.all
+ developers.cache_version
+
+ Developer.update_all(updated_at: Time.now.utc + 1.second)
+
+ developers.cache_version # Stale cache_version
+ developers.reset
+ developers.cache_version # Returns the current correct cache_version
+ ```
+
+ Fixes #45341.
+
+ *Austen Madden*
+
+* Fix `load_async` when called on an association proxy.
+
+ Calling `load_async` directly an association would schedule
+ a query but never use it.
+
+ ```ruby
+ comments = post.comments.load_async # schedule a query
+ comments.to_a # perform an entirely new sync query
+ ```
+
+ Now it does use the async query, however note that it doesn't
+ cause the association to be loaded.
+
+ *Jean Boussier*
+
+* Fix eager loading for models without primary keys.
+
+ *Anmol Chopra*, *Matt Lawrence*, and *Jonathan Hefner*
+
+* `rails db:schema:{dump,load}` now checks `ENV["SCHEMA_FORMAT"]` before
config
+
+ Since `rails db:structure:{dump,load}` was deprecated there wasn't a simple
+ way to dump a schema to both SQL and Ruby formats. You can now do this with
+ an environment variable. For example:
+
+ ```
+ SCHEMA_FORMAT=sql rake db:schema:dump
+ ```
+
+ *Alex Ghiculescu*
+
+* Fix Hstore deserialize regression.
+
+ *edsharp*
+
+
## Rails 7.0.3.1 (July 12, 2022) ##
* Change ActiveRecord::Coders::YAMLColumn default to safe_load
Binary files old/checksums.yaml.gz and new/checksums.yaml.gz differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/associations/collection_association.rb
new/lib/active_record/associations/collection_association.rb
--- old/lib/active_record/associations/collection_association.rb
2022-07-12 19:30:22.000000000 +0200
+++ new/lib/active_record/associations/collection_association.rb
2022-09-09 20:42:16.000000000 +0200
@@ -320,7 +320,6 @@
# * Otherwise, attributes should have the value found in the database
def merge_target_lists(persisted, memory)
return persisted if memory.empty?
- return memory if persisted.empty?
persisted.map! do |record|
if mem_record = memory.delete(record)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/associations/collection_proxy.rb
new/lib/active_record/associations/collection_proxy.rb
--- old/lib/active_record/associations/collection_proxy.rb 2022-07-12
19:30:22.000000000 +0200
+++ new/lib/active_record/associations/collection_proxy.rb 2022-09-09
20:42:16.000000000 +0200
@@ -1108,7 +1108,7 @@
].flat_map { |klass|
klass.public_instance_methods(false)
} - self.public_instance_methods(false) - [:select] + [
- :scoping, :values, :insert, :insert_all, :insert!, :insert_all!,
:upsert, :upsert_all
+ :scoping, :values, :insert, :insert_all, :insert!, :insert_all!,
:upsert, :upsert_all, :load_async
]
delegate(*delegate_methods, to: :scope)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/associations/has_many_association.rb
new/lib/active_record/associations/has_many_association.rb
--- old/lib/active_record/associations/has_many_association.rb 2022-07-12
19:30:22.000000000 +0200
+++ new/lib/active_record/associations/has_many_association.rb 2022-09-09
20:42:16.000000000 +0200
@@ -79,10 +79,13 @@
scope.count(:all)
end
- # If there's nothing in the database and @target has no new records
- # we are certain the current target is an empty array. This is a
- # documented side-effect of the method that may avoid an extra
SELECT.
- loaded! if count == 0
+ # If there's nothing in the database, @target should only contain new
+ # records or be an empty array. This is a documented side-effect of
+ # the method that may avoid an extra SELECT.
+ if count == 0
+ target.select!(&:new_record?)
+ loaded!
+ end
[association_scope.limit_value, count].compact.min
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/associations/join_dependency.rb
new/lib/active_record/associations/join_dependency.rb
--- old/lib/active_record/associations/join_dependency.rb 2022-07-12
19:30:22.000000000 +0200
+++ new/lib/active_record/associations/join_dependency.rb 2022-09-09
20:42:16.000000000 +0200
@@ -252,35 +252,39 @@
next
end
- key = aliases.column_alias(node, node.primary_key)
- id = row[key]
- if id.nil?
+ if node.primary_key
+ key = aliases.column_alias(node, node.primary_key)
+ id = row[key]
+ else
+ key = aliases.column_alias(node,
node.reflection.join_primary_key.to_s)
+ id = nil # Avoid id-based model caching.
+ end
+
+ if row[key].nil?
nil_association = ar_parent.association(node.reflection.name)
nil_association.loaded!
next
end
- model = seen[ar_parent][node][id]
-
- if model
- construct(model, node, row, seen, model_cache,
strict_loading_value)
- else
+ unless model = seen[ar_parent][node][id]
model = construct_model(ar_parent, node, row, model_cache, id,
strict_loading_value)
-
- seen[ar_parent][node][id] = model
- construct(model, node, row, seen, model_cache,
strict_loading_value)
+ seen[ar_parent][node][id] = model if id
end
+
+ construct(model, node, row, seen, model_cache,
strict_loading_value)
end
end
def construct_model(record, node, row, model_cache, id,
strict_loading_value)
other = record.association(node.reflection.name)
- model = model_cache[node][id] ||=
- node.instantiate(row, aliases.column_aliases(node)) do |m|
+ unless model = model_cache[node][id]
+ model = node.instantiate(row, aliases.column_aliases(node)) do |m|
m.strict_loading! if strict_loading_value
other.set_inverse_instance(m)
end
+ model_cache[node][id] = model if id
+ end
if node.reflection.collection?
other.target.push(model)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/associations.rb
new/lib/active_record/associations.rb
--- old/lib/active_record/associations.rb 2022-07-12 19:30:22.000000000
+0200
+++ new/lib/active_record/associations.rb 2022-09-09 20:42:16.000000000
+0200
@@ -628,15 +628,15 @@
#
# Note: To trigger remove callbacks, you must use +destroy+ /
+destroy_all+ methods. For example:
#
- # * <tt>firm.clients.destroy(client)</tt>
- # * <tt>firm.clients.destroy(*clients)</tt>
- # * <tt>firm.clients.destroy_all</tt>
+ # * <tt>firm.clients.destroy(client)</tt>
+ # * <tt>firm.clients.destroy(*clients)</tt>
+ # * <tt>firm.clients.destroy_all</tt>
#
# +delete+ / +delete_all+ methods like the following do *not* trigger
remove callbacks:
#
- # * <tt>firm.clients.delete(client)</tt>
- # * <tt>firm.clients.delete(*clients)</tt>
- # * <tt>firm.clients.delete_all</tt>
+ # * <tt>firm.clients.delete(client)</tt>
+ # * <tt>firm.clients.delete(*clients)</tt>
+ # * <tt>firm.clients.delete_all</tt>
#
# == Association extensions
#
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/attribute_methods/time_zone_conversion.rb
new/lib/active_record/attribute_methods/time_zone_conversion.rb
--- old/lib/active_record/attribute_methods/time_zone_conversion.rb
2022-07-12 19:30:22.000000000 +0200
+++ new/lib/active_record/attribute_methods/time_zone_conversion.rb
2022-09-09 20:42:16.000000000 +0200
@@ -19,6 +19,8 @@
if value.is_a?(Hash)
set_time_zone_without_conversion(super)
+ elsif value.is_a?(Range)
+ Range.new(user_input_in_time_zone(value.begin),
user_input_in_time_zone(value.end), value.exclude_end?)
elsif value.respond_to?(:in_time_zone)
begin
super(user_input_in_time_zone(value)) || super
@@ -40,6 +42,8 @@
value.in_time_zone
elsif value.respond_to?(:infinite?) && value.infinite?
value
+ elsif value.is_a?(Range)
+ Range.new(convert_time_to_time_zone(value.begin),
convert_time_to_time_zone(value.end), value.exclude_end?)
else
map_avoiding_infinite_recursion(value) { |v|
convert_time_to_time_zone(v) }
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/coders/yaml_column.rb
new/lib/active_record/coders/yaml_column.rb
--- old/lib/active_record/coders/yaml_column.rb 2022-07-12 19:30:22.000000000
+0200
+++ new/lib/active_record/coders/yaml_column.rb 2022-09-09 20:42:16.000000000
+0200
@@ -45,14 +45,20 @@
raise ArgumentError, "Cannot serialize #{object_class}. Classes
passed to `serialize` must have a 0 argument constructor."
end
- def yaml_load(payload)
- if !ActiveRecord.use_yaml_unsafe_load
- YAML.safe_load(payload, permitted_classes:
ActiveRecord.yaml_column_permitted_classes, aliases: true)
- else
- if YAML.respond_to?(:unsafe_load)
+ if YAML.respond_to?(:unsafe_load)
+ def yaml_load(payload)
+ if ActiveRecord.use_yaml_unsafe_load
YAML.unsafe_load(payload)
else
+ YAML.safe_load(payload, permitted_classes:
ActiveRecord.yaml_column_permitted_classes, aliases: true)
+ end
+ end
+ else
+ def yaml_load(payload)
+ if ActiveRecord.use_yaml_unsafe_load
YAML.load(payload)
+ else
+ YAML.safe_load(payload, permitted_classes:
ActiveRecord.yaml_column_permitted_classes, aliases: true)
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
new/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
--- old/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
2022-07-12 19:30:22.000000000 +0200
+++ new/lib/active_record/connection_adapters/abstract_mysql_adapter.rb
2022-09-09 20:42:16.000000000 +0200
@@ -139,7 +139,7 @@
end
def field_ordered_value(column, values) # :nodoc:
- field = Arel::Nodes::NamedFunction.new("FIELD", [column,
values.reverse])
+ field = Arel::Nodes::NamedFunction.new("FIELD", [column,
values.reverse.map { |value| Arel::Nodes.build_quoted(value) }])
Arel::Nodes::Descending.new(field)
end
@@ -711,6 +711,10 @@
options[:comment] = column.comment
end
+ unless options.key?(:collation)
+ options[:collation] = column.collation
+ end
+
unless options.key?(:auto_increment)
options[:auto_increment] = column.auto_increment?
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/connection_adapters/mysql/schema_statements.rb
new/lib/active_record/connection_adapters/mysql/schema_statements.rb
--- old/lib/active_record/connection_adapters/mysql/schema_statements.rb
2022-07-12 19:30:22.000000000 +0200
+++ new/lib/active_record/connection_adapters/mysql/schema_statements.rb
2022-09-09 20:42:16.000000000 +0200
@@ -159,7 +159,7 @@
end
def default_type(table_name, field_name)
- match = create_table_info(table_name).match(/`#{field_name}` (.+)
DEFAULT ('|\d+|[A-z]+)/)
+ match = create_table_info(table_name)&.match(/`#{field_name}` (.+)
DEFAULT ('|\d+|[A-z]+)/)
default_pre = match[2] if match
if default_pre == "'"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/connection_adapters/postgresql/oid/hstore.rb
new/lib/active_record/connection_adapters/postgresql/oid/hstore.rb
--- old/lib/active_record/connection_adapters/postgresql/oid/hstore.rb
2022-07-12 19:30:22.000000000 +0200
+++ new/lib/active_record/connection_adapters/postgresql/oid/hstore.rb
2022-09-09 20:42:16.000000000 +0200
@@ -26,7 +26,7 @@
raise(ArgumentError, ERROR % scanner.string.inspect)
end
- unless key = scanner.scan_until(/(?<!\\)(?=")/)
+ unless key = scanner.scan(/^(\\[\\"]|[^\\"])*?(?=")/)
raise(ArgumentError, ERROR % scanner.string.inspect)
end
@@ -41,7 +41,7 @@
raise(ArgumentError, ERROR % scanner.string.inspect)
end
- unless value = scanner.scan_until(/(?<!\\)(?=")/)
+ unless value = scanner.scan(/^(\\[\\"]|[^\\"])*?(?=")/)
raise(ArgumentError, ERROR % scanner.string.inspect)
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/connection_adapters/postgresql/referential_integrity.rb
new/lib/active_record/connection_adapters/postgresql/referential_integrity.rb
---
old/lib/active_record/connection_adapters/postgresql/referential_integrity.rb
2022-07-12 19:30:22.000000000 +0200
+++
new/lib/active_record/connection_adapters/postgresql/referential_integrity.rb
2022-09-09 20:42:16.000000000 +0200
@@ -45,8 +45,10 @@
BEGIN
FOR r IN (
SELECT FORMAT(
- 'UPDATE pg_constraint SET convalidated=false WHERE conname =
''%I''; ALTER TABLE %I VALIDATE CONSTRAINT %I;',
+ 'UPDATE pg_constraint SET convalidated=false WHERE conname =
''%I'' AND connamespace::regnamespace = ''%I''::regnamespace; ALTER TABLE %I.%I
VALIDATE CONSTRAINT %I;',
constraint_name,
+ table_schema,
+ table_schema,
table_name,
constraint_name
) AS constraint_check
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/connection_adapters/postgresql_adapter.rb
new/lib/active_record/connection_adapters/postgresql_adapter.rb
--- old/lib/active_record/connection_adapters/postgresql_adapter.rb
2022-07-12 19:30:22.000000000 +0200
+++ new/lib/active_record/connection_adapters/postgresql_adapter.rb
2022-09-09 20:42:16.000000000 +0200
@@ -1063,5 +1063,6 @@
ActiveRecord::Type.register(:vector, OID::Vector, adapter: :postgresql)
ActiveRecord::Type.register(:xml, OID::Xml, adapter: :postgresql)
end
+ ActiveSupport.run_load_hooks(:active_record_postgresqladapter,
PostgreSQLAdapter)
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/connection_adapters/sqlite3/schema_statements.rb
new/lib/active_record/connection_adapters/sqlite3/schema_statements.rb
--- old/lib/active_record/connection_adapters/sqlite3/schema_statements.rb
2022-07-12 19:30:22.000000000 +0200
+++ new/lib/active_record/connection_adapters/sqlite3/schema_statements.rb
2022-09-09 20:42:16.000000000 +0200
@@ -21,7 +21,7 @@
WHERE name = #{quote(row['name'])} AND type = 'index'
SQL
-
/\bON\b\s*"?(\w+?)"?\s*\((?<expressions>.+?)\)(?:\s*WHERE\b\s*(?<where>.+))?\z/i
=~ index_sql
+
/\bON\b\s*"?(\w+?)"?\s*\((?<expressions>.+?)\)(?:\s*WHERE\b\s*(?<where>.+))?(?:\s*\/\*.*\*\/)?\z/i
=~ index_sql
columns = exec_query("PRAGMA index_info(#{quote(row['name'])})",
"SCHEMA").map do |col|
col["name"]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore'
old/lib/active_record/connection_adapters/sqlite3_adapter.rb
new/lib/active_record/connection_adapters/sqlite3_adapter.rb
--- old/lib/active_record/connection_adapters/sqlite3_adapter.rb
2022-07-12 19:30:22.000000000 +0200
+++ new/lib/active_record/connection_adapters/sqlite3_adapter.rb
2022-09-09 20:42:16.000000000 +0200
@@ -341,7 +341,7 @@
end
def get_database_version # :nodoc:
- SQLite3Adapter::Version.new(query_value("SELECT sqlite_version(*)"))
+ SQLite3Adapter::Version.new(query_value("SELECT sqlite_version(*)",
"SCHEMA"))
end
def check_version # :nodoc:
@@ -477,8 +477,13 @@
options[:rename][column.name.to_sym] ||
column.name) : column.name
+ if column.has_default?
+ type = lookup_cast_type_from_column(column)
+ default = type.deserialize(column.default)
+ end
+
@definition.column(column_name, column.type,
- limit: column.limit, default: column.default,
+ limit: column.limit, default: default,
precision: column.precision, scale: column.scale,
null: column.null, collation: column.collation,
primary_key: column_name == from_primary_key
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/delegated_type.rb
new/lib/active_record/delegated_type.rb
--- old/lib/active_record/delegated_type.rb 2022-07-12 19:30:22.000000000
+0200
+++ new/lib/active_record/delegated_type.rb 2022-09-09 20:42:16.000000000
+0200
@@ -136,7 +136,7 @@
# end
# end
#
- # Now you can list a bunch of entries, call +Entry#title+, and polymorphism
will provide you with the answer.
+ # Now you can list a bunch of entries, call <tt>Entry#title</tt>, and
polymorphism will provide you with the answer.
#
# == Nested Attributes
#
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/encryption/message.rb
new/lib/active_record/encryption/message.rb
--- old/lib/active_record/encryption/message.rb 2022-07-12 19:30:22.000000000
+0200
+++ new/lib/active_record/encryption/message.rb 2022-09-09 20:42:16.000000000
+0200
@@ -7,7 +7,7 @@
# * An encrypted payload
# * A list of unencrypted headers
#
- # See +Encryptor#encrypt+
+ # See Encryptor#encrypt
class Message
attr_accessor :payload, :headers
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/encryption/properties.rb
new/lib/active_record/encryption/properties.rb
--- old/lib/active_record/encryption/properties.rb 2022-07-12
19:30:22.000000000 +0200
+++ new/lib/active_record/encryption/properties.rb 2022-09-09
20:42:16.000000000 +0200
@@ -12,7 +12,7 @@
#
# message.headers.encrypted_data_key # instead of message.headers[:k]
#
- # See +Properties#DEFAULT_PROPERTIES+, +Key+, +Message+
+ # See +Properties::DEFAULT_PROPERTIES+, Key, Message
class Properties
ALLOWED_VALUE_CLASSES = [String, ActiveRecord::Encryption::Message,
Numeric, TrueClass, FalseClass, Symbol, NilClass]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/gem_version.rb
new/lib/active_record/gem_version.rb
--- old/lib/active_record/gem_version.rb 2022-07-12 19:30:22.000000000
+0200
+++ new/lib/active_record/gem_version.rb 2022-09-09 20:42:16.000000000
+0200
@@ -9,8 +9,8 @@
module VERSION
MAJOR = 7
MINOR = 0
- TINY = 3
- PRE = "1"
+ TINY = 4
+ PRE = nil
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/middleware/database_selector.rb
new/lib/active_record/middleware/database_selector.rb
--- old/lib/active_record/middleware/database_selector.rb 2022-07-12
19:30:22.000000000 +0200
+++ new/lib/active_record/middleware/database_selector.rb 2022-09-09
20:42:16.000000000 +0200
@@ -44,7 +44,7 @@
# config.active_record.database_resolver_context = MyResolver::MySession
#
# Note: If you are using `rails new my_app --minimal` you will need to call
- # `require "active_support/core_ext/integer/time"` to load the libaries
+ # `require "active_support/core_ext/integer/time"` to load the libraries
# for +Time+.
class DatabaseSelector
def initialize(app, resolver_klass = nil, context_klass = nil, options =
{})
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/model_schema.rb
new/lib/active_record/model_schema.rb
--- old/lib/active_record/model_schema.rb 2022-07-12 19:30:22.000000000
+0200
+++ new/lib/active_record/model_schema.rb 2022-09-09 20:42:16.000000000
+0200
@@ -126,6 +126,27 @@
# +:immutable_string+. This setting does not affect the behavior of
# <tt>attribute :foo, :string</tt>. Defaults to false.
+ ##
+ # :singleton-method: inheritance_column
+ # :call-seq: inheritance_column
+ #
+ # The name of the table column which stores the class name on single-table
+ # inheritance situations.
+ #
+ # The default inheritance column name is +type+, which means it's a
+ # reserved word inside Active Record. To be able to use single-table
+ # inheritance with another column name, or to use the column +type+ in
+ # your own model for something else, you can set +inheritance_column+:
+ #
+ # self.inheritance_column = 'zoink'
+
+ ##
+ # :singleton-method: inheritance_column=
+ # :call-seq: inheritance_column=(column)
+ #
+ # Defines the name of the table column which will store the class name on
single-table
+ # inheritance situations.
+
included do
class_attribute :primary_key_prefix_type, instance_writer: false
class_attribute :table_name_prefix, instance_writer: false, default: ""
@@ -136,15 +157,6 @@
class_attribute :implicit_order_column, instance_accessor: false
class_attribute :immutable_strings_by_default, instance_accessor: false
- # Defines the name of the table column which will store the class name
on single-table
- # inheritance situations.
- #
- # The default inheritance column name is +type+, which means it's a
- # reserved word inside Active Record. To be able to use single-table
- # inheritance with another column name, or to use the column +type+ in
- # your own model for something else, you can set +inheritance_column+:
- #
- # self.inheritance_column = 'zoink'
class_attribute :inheritance_column, instance_accessor: false, default:
"type"
singleton_class.class_eval do
alias_method :_inheritance_column=, :inheritance_column=
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/railtie.rb
new/lib/active_record/railtie.rb
--- old/lib/active_record/railtie.rb 2022-07-12 19:30:22.000000000 +0200
+++ new/lib/active_record/railtie.rb 2022-09-09 20:42:16.000000000 +0200
@@ -78,6 +78,12 @@
end
end
+ initializer "active_record.postgresql_time_zone_aware_types" do
+ ActiveSupport.on_load(:active_record_postgresqladapter) do
+ ActiveRecord::Base.time_zone_aware_types << :timestamptz
+ end
+ end
+
initializer "active_record.logger" do
ActiveSupport.on_load(:active_record) { self.logger ||= ::Rails.logger }
end
@@ -94,22 +100,6 @@
end
end
- initializer "active_record.database_selector" do
- if options = config.active_record.database_selector
- resolver = config.active_record.database_resolver
- operations = config.active_record.database_resolver_context
- config.app_middleware.use ActiveRecord::Middleware::DatabaseSelector,
resolver, operations, options
- end
- end
-
- initializer "active_record.shard_selector" do
- if resolver = config.active_record.shard_resolver
- options = config.active_record.shard_selector || {}
-
- config.app_middleware.use ActiveRecord::Middleware::ShardSelector,
resolver, options
- end
- end
-
initializer "Check for cache versioning support" do
config.after_initialize do |app|
ActiveSupport.on_load(:active_record) do
@@ -403,23 +393,5 @@
end
end
end
-
- initializer "active_record.use_yaml_unsafe_load" do |app|
- config.after_initialize do
- unless app.config.active_record.use_yaml_unsafe_load.nil?
- ActiveRecord.use_yaml_unsafe_load =
- app.config.active_record.use_yaml_unsafe_load
- end
- end
- end
-
- initializer "active_record.yaml_column_permitted_classes" do |app|
- config.after_initialize do
- unless app.config.active_record.yaml_column_permitted_classes.nil?
- ActiveRecord.yaml_column_permitted_classes =
- app.config.active_record.yaml_column_permitted_classes
- end
- end
- end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/railties/databases.rake
new/lib/active_record/railties/databases.rake
--- old/lib/active_record/railties/databases.rake 2022-07-12
19:30:22.000000000 +0200
+++ new/lib/active_record/railties/databases.rake 2022-09-09
20:42:16.000000000 +0200
@@ -452,30 +452,32 @@
end
namespace :schema do
- desc "Creates a database schema file (either db/schema.rb or
db/structure.sql, depending on `config.active_record.schema_format`)"
+ desc "Creates a database schema file (either db/schema.rb or
db/structure.sql, depending on `ENV['SCHEMA_FORMAT']` or
`config.active_record.schema_format`)"
task dump: :load_config do
ActiveRecord::Base.configurations.configs_for(env_name:
ActiveRecord::Tasks::DatabaseTasks.env).each do |db_config|
if db_config.schema_dump
ActiveRecord::Base.establish_connection(db_config)
- ActiveRecord::Tasks::DatabaseTasks.dump_schema(db_config)
+ schema_format = ENV.fetch("SCHEMA_FORMAT",
ActiveRecord.schema_format).to_sym
+ ActiveRecord::Tasks::DatabaseTasks.dump_schema(db_config,
schema_format)
end
end
db_namespace["schema:dump"].reenable
end
- desc "Loads a database schema file (either db/schema.rb or
db/structure.sql, depending on `config.active_record.schema_format`) into the
database"
+ desc "Loads a database schema file (either db/schema.rb or
db/structure.sql, depending on `ENV['SCHEMA_FORMAT']` or
`config.active_record.schema_format`) into the database"
task load: [:load_config, :check_protected_environments] do
ActiveRecord::Tasks::DatabaseTasks.load_schema_current(ActiveRecord.schema_format,
ENV["SCHEMA"])
end
namespace :dump do
ActiveRecord::Tasks::DatabaseTasks.for_each(databases) do |name|
- desc "Creates a database schema file (either db/schema.rb or
db/structure.sql, depending on `config.active_record.schema_format`) for
#{name} database"
+ desc "Creates a database schema file (either db/schema.rb or
db/structure.sql, depending on `ENV['SCHEMA_FORMAT']` or
`config.active_record.schema_format`) for #{name} database"
task name => :load_config do
db_config = ActiveRecord::Base.configurations.configs_for(env_name:
ActiveRecord::Tasks::DatabaseTasks.env, name: name)
ActiveRecord::Base.establish_connection(db_config)
- ActiveRecord::Tasks::DatabaseTasks.dump_schema(db_config)
+ schema_format = ENV.fetch("SCHEMA_FORMAT",
ActiveRecord.schema_format).to_sym
+ ActiveRecord::Tasks::DatabaseTasks.dump_schema(db_config,
schema_format)
db_namespace["schema:dump:#{name}"].reenable
end
end
@@ -483,11 +485,12 @@
namespace :load do
ActiveRecord::Tasks::DatabaseTasks.for_each(databases) do |name|
- desc "Loads a database schema file (either db/schema.rb or
db/structure.sql, depending on `config.active_record.schema_format`) into the
#{name} database"
+ desc "Loads a database schema file (either db/schema.rb or
db/structure.sql, depending on `ENV['SCHEMA_FORMAT']` or
`config.active_record.schema_format`) into the #{name} database"
task name => [:load_config, :check_protected_environments] do
original_db_config = ActiveRecord::Base.connection_db_config
db_config = ActiveRecord::Base.configurations.configs_for(env_name:
ActiveRecord::Tasks::DatabaseTasks.env, name: name)
- ActiveRecord::Tasks::DatabaseTasks.load_schema(db_config)
+ schema_format = ENV.fetch("SCHEMA_FORMAT",
ActiveRecord.schema_format).to_sym
+ ActiveRecord::Tasks::DatabaseTasks.load_schema(db_config,
schema_format)
ensure
ActiveRecord::Base.establish_connection(original_db_config) if
original_db_config
end
@@ -545,12 +548,13 @@
db_namespace["test:load_schema"].invoke
end
- # desc "Recreate the test database from an existent schema file (schema.rb
or structure.sql, depending on `config.active_record.schema_format`)"
+ # desc "Recreate the test database from an existent schema file (schema.rb
or structure.sql, depending on `ENV['SCHEMA_FORMAT']` or
`config.active_record.schema_format`)"
task load_schema: %w(db:test:purge) do
should_reconnect = ActiveRecord::Base.connection_pool.active_connection?
ActiveRecord::Schema.verbose = false
ActiveRecord::Base.configurations.configs_for(env_name: "test").each do
|db_config|
- ActiveRecord::Tasks::DatabaseTasks.load_schema(db_config)
+ schema_format = ENV.fetch("SCHEMA_FORMAT",
ActiveRecord.schema_format).to_sym
+ ActiveRecord::Tasks::DatabaseTasks.load_schema(db_config,
schema_format)
end
ensure
if should_reconnect
@@ -586,7 +590,8 @@
should_reconnect =
ActiveRecord::Base.connection_pool.active_connection?
ActiveRecord::Schema.verbose = false
db_config = ActiveRecord::Base.configurations.configs_for(env_name:
"test", name: name)
- ActiveRecord::Tasks::DatabaseTasks.load_schema(db_config)
+ schema_format = ENV.fetch("SCHEMA_FORMAT",
ActiveRecord.schema_format).to_sym
+ ActiveRecord::Tasks::DatabaseTasks.load_schema(db_config,
schema_format)
ensure
if should_reconnect
ActiveRecord::Base.establish_connection(ActiveRecord::Tasks::DatabaseTasks.env.to_sym)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/relation/query_methods.rb
new/lib/active_record/relation/query_methods.rb
--- old/lib/active_record/relation/query_methods.rb 2022-07-12
19:30:22.000000000 +0200
+++ new/lib/active_record/relation/query_methods.rb 2022-09-09
20:42:16.000000000 +0200
@@ -10,10 +10,10 @@
module QueryMethods
include ActiveModel::ForbiddenAttributesProtection
- # WhereChain objects act as placeholder for queries in which #where does
not have any parameter.
- # In this case, #where must be chained with #not to return a new relation.
+ # WhereChain objects act as placeholder for queries in which +where+ does
not have any parameter.
+ # In this case, +where+ can be chained to return a new relation.
class WhereChain
- def initialize(scope)
+ def initialize(scope) # :nodoc:
@scope = scope
end
@@ -717,12 +717,26 @@
# === no argument
#
# If no argument is passed, #where returns a new instance of WhereChain,
that
- # can be chained with #not to return a new relation that negates the where
clause.
+ # can be chained with WhereChain#not, WhereChain#missing, or
WhereChain#associated.
+ #
+ # Chaining with WhereChain#not:
#
# User.where.not(name: "Jon")
# # SELECT * FROM users WHERE name != 'Jon'
#
- # See WhereChain for more details on #not.
+ # Chaining with WhereChain#associated:
+ #
+ # Post.where.associated(:author)
+ # # SELECT "posts".* FROM "posts"
+ # # INNER JOIN "authors" ON "authors"."id" = "posts"."author_id"
+ # # WHERE "authors"."id" IS NOT NULL
+ #
+ # Chaining with WhereChain#missing:
+ #
+ # Post.where.missing(:author)
+ # # SELECT "posts".* FROM "posts"
+ # # LEFT OUTER JOIN "authors" ON "authors"."id" = "posts"."author_id"
+ # # WHERE "authors"."id" IS NULL
#
# === blank condition
#
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/relation.rb
new/lib/active_record/relation.rb
--- old/lib/active_record/relation.rb 2022-07-12 19:30:22.000000000 +0200
+++ new/lib/active_record/relation.rb 2022-09-09 20:42:16.000000000 +0200
@@ -712,6 +712,7 @@
@to_sql = @arel = @loaded = @should_eager_load = nil
@offsets = @take = nil
@cache_keys = nil
+ @cache_versions = nil
@records = nil
self
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/scoping/default.rb
new/lib/active_record/scoping/default.rb
--- old/lib/active_record/scoping/default.rb 2022-07-12 19:30:22.000000000
+0200
+++ new/lib/active_record/scoping/default.rb 2022-09-09 20:42:16.000000000
+0200
@@ -146,11 +146,13 @@
end
elsif default_scopes.any?
evaluate_default_scope do
- default_scopes.inject(relation) do |default_scope, scope_obj|
+ default_scopes.inject(relation) do |combined_scope, scope_obj|
if execute_scope?(all_queries, scope_obj)
scope = scope_obj.scope.respond_to?(:to_proc) ?
scope_obj.scope : scope_obj.scope.method(:call)
- default_scope.instance_exec(&scope) || default_scope
+ combined_scope.instance_exec(&scope) || combined_scope
+ else
+ combined_scope
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/signed_id.rb
new/lib/active_record/signed_id.rb
--- old/lib/active_record/signed_id.rb 2022-07-12 19:30:22.000000000 +0200
+++ new/lib/active_record/signed_id.rb 2022-09-09 20:42:16.000000000 +0200
@@ -97,7 +97,7 @@
# Returns a signed id that's generated using a preconfigured
+ActiveSupport::MessageVerifier+ instance.
# This signed id is tamper proof, so it's safe to send in an email or
otherwise share with the outside world.
- # It can further more be set to expire (the default is not to expire), and
scoped down with a specific purpose.
+ # It can furthermore be set to expire (the default is not to expire), and
scoped down with a specific purpose.
# If the expiration date has been exceeded before +find_signed+ is called,
the id won't find the designated
# record. If a purpose is set, this too must match.
#
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/store.rb
new/lib/active_record/store.rb
--- old/lib/active_record/store.rb 2022-07-12 19:30:22.000000000 +0200
+++ new/lib/active_record/store.rb 2022-09-09 20:42:16.000000000 +0200
@@ -59,7 +59,7 @@
# u.color = 'green'
# u.color_changed? # => true
# u.color_was # => 'black'
- # u.color_change # => ['black', 'red']
+ # u.color_change # => ['black', 'green']
#
# # Add additional accessors to an existing store through store_accessor
# class SuperUser < User
@@ -268,7 +268,7 @@
end
def dump(obj)
- @coder.dump self.class.as_indifferent_hash(obj)
+ @coder.dump as_regular_hash(obj)
end
def load(yaml)
@@ -285,6 +285,11 @@
ActiveSupport::HashWithIndifferentAccess.new
end
end
+
+ private
+ def as_regular_hash(obj)
+ obj.respond_to?(:to_hash) ? obj.to_hash : {}
+ end
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record/test_fixtures.rb
new/lib/active_record/test_fixtures.rb
--- old/lib/active_record/test_fixtures.rb 2022-07-12 19:30:22.000000000
+0200
+++ new/lib/active_record/test_fixtures.rb 2022-09-09 20:42:16.000000000
+0200
@@ -137,7 +137,7 @@
@connection_subscriber =
ActiveSupport::Notifications.subscribe("!connection.active_record") do |_, _,
_, _, payload|
spec_name = payload[:spec_name] if payload.key?(:spec_name)
shard = payload[:shard] if payload.key?(:shard)
- setup_shared_connection_pool
+ setup_shared_connection_pool if
ActiveRecord.legacy_connection_handling
if spec_name
begin
@@ -146,10 +146,14 @@
connection = nil
end
- if connection && !@fixture_connections.include?(connection)
- connection.begin_transaction joinable: false, _lazy: false
- connection.pool.lock_thread = true if lock_threads
- @fixture_connections << connection
+ if connection
+ setup_shared_connection_pool unless
ActiveRecord.legacy_connection_handling
+
+ if !@fixture_connections.include?(connection)
+ connection.begin_transaction joinable: false, _lazy: false
+ connection.pool.lock_thread = true if lock_threads
+ @fixture_connections << connection
+ end
end
end
end
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/lib/active_record.rb new/lib/active_record.rb
--- old/lib/active_record.rb 2022-07-12 19:30:22.000000000 +0200
+++ new/lib/active_record.rb 2022-09-09 20:42:16.000000000 +0200
@@ -352,7 +352,7 @@
# Application configurable array that provides additional permitted classes
# to Psych safe_load in the YAML Coder
singleton_class.attr_accessor :yaml_column_permitted_classes
- self.yaml_column_permitted_classes = []
+ self.yaml_column_permitted_classes = [Symbol]
def self.eager_load!
super
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn'
'--exclude=.svnignore' old/metadata new/metadata
--- old/metadata 2022-07-12 19:30:22.000000000 +0200
+++ new/metadata 2022-09-09 20:42:16.000000000 +0200
@@ -1,14 +1,14 @@
--- !ruby/object:Gem::Specification
name: activerecord
version: !ruby/object:Gem::Version
- version: 7.0.3.1
+ version: 7.0.4
platform: ruby
authors:
- David Heinemeier Hansson
autorequire:
bindir: bin
cert_chain: []
-date: 2022-07-12 00:00:00.000000000 Z
+date: 2022-09-09 00:00:00.000000000 Z
dependencies:
- !ruby/object:Gem::Dependency
name: activesupport
@@ -16,28 +16,28 @@
requirements:
- - '='
- !ruby/object:Gem::Version
- version: 7.0.3.1
+ version: 7.0.4
type: :runtime
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - '='
- !ruby/object:Gem::Version
- version: 7.0.3.1
+ version: 7.0.4
- !ruby/object:Gem::Dependency
name: activemodel
requirement: !ruby/object:Gem::Requirement
requirements:
- - '='
- !ruby/object:Gem::Version
- version: 7.0.3.1
+ version: 7.0.4
type: :runtime
prerelease: false
version_requirements: !ruby/object:Gem::Requirement
requirements:
- - '='
- !ruby/object:Gem::Version
- version: 7.0.3.1
+ version: 7.0.4
description: Databases on Rails. Build a persistent domain model by mapping
database
tables to Ruby classes. Strong conventions for associations, validations,
aggregations,
migrations, and testing come baked-in.
@@ -434,10 +434,10 @@
- MIT
metadata:
bug_tracker_uri: https://github.com/rails/rails/issues
- changelog_uri:
https://github.com/rails/rails/blob/v7.0.3.1/activerecord/CHANGELOG.md
- documentation_uri: https://api.rubyonrails.org/v7.0.3.1/
+ changelog_uri:
https://github.com/rails/rails/blob/v7.0.4/activerecord/CHANGELOG.md
+ documentation_uri: https://api.rubyonrails.org/v7.0.4/
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
- source_code_uri: https://github.com/rails/rails/tree/v7.0.3.1/activerecord
+ source_code_uri: https://github.com/rails/rails/tree/v7.0.4/activerecord
rubygems_mfa_required: 'true'
post_install_message:
rdoc_options: