From 22b5e12a53a3183127a13f8552cfb748f9b7525d Mon Sep 17 00:00:00 2001 From: Vaishnavi Aswale <48441026+Vaishnavi-Aswale@users.noreply.github.com> Date: Tue, 27 May 2025 14:34:59 -0700 Subject: [PATCH] fix: use supported access method for schema_format in Rails 7 (#11576) Description In Rails 7.1+, accessing `schema_format` via `ActiveRecord::Base` is no longer supported, causing a method error. The correct approach is to use `ActiveRecord.schema_format`, which aligns with the public API. This issue occurs locally because the environment uses newer versions of Ruby and Rails than others. Fixes: https://github.com/chatwoot/chatwoot/issues/11594 Co-authored-by: Sojan Jose --- lib/tasks/db_enhancements.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/db_enhancements.rake b/lib/tasks/db_enhancements.rake index d9cc22334..5fddb6cde 100644 --- a/lib/tasks/db_enhancements.rake +++ b/lib/tasks/db_enhancements.rake @@ -18,7 +18,7 @@ db_namespace = namespace :db do ActiveRecord::Base.configurations.configs_for(env_name: Rails.env).each do |db_config| ActiveRecord::Base.establish_connection(db_config.configuration_hash) unless ActiveRecord::Base.connection.table_exists? 'ar_internal_metadata' - db_namespace['load_config'].invoke if ActiveRecord::Base.schema_format == :ruby + db_namespace['load_config'].invoke if ActiveRecord.schema_format == :ruby ActiveRecord::Tasks::DatabaseTasks.load_schema_current(:ruby, ENV.fetch('SCHEMA', nil)) db_namespace['seed'].invoke end