2023/03/01分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
- Allow applications to register a custom database configuration handler.
- Allow applications to lookup a config via a custom hash key.
- Remove the
:include_replicas
argument fromconfigs_for
. Use:include_hidden
argument instead.
actionmailer/CHANGELOG.md
Allow applications to register custom database configurations
activerecord/lib/active_record/database_configurations.rb
の修正です。
database configurationを処理する為のhandlerに独自のhandlerを設定出来るよう修正しています。handlerはActiveRecord::DatabaseConfigurations.register_db_config_handler
で登録する必要があります。例えば、custom_config
というkeyが指定されていた場合に、CustomConfig
というhandlerを使用したい場合下記のように設定すれば良いようになっています。
# database.yml development: primary: url: postgres://localhost/primary animals: url: postgres://localhost/animals custom_config: sharded: 1
class CustomConfig < ActiveRecord::DatabaseConfigurations::UrlConfig def sharded? custom_config.fetch("sharded", false) end private def custom_config configuration_hash.fetch(:custom_config) end end
ActiveRecord::DatabaseConfigurations.register_db_config_handler do |env_name, name, url, config| next unless config.key?(:custom_config) CustomConfig.new(env_name, name, url, config) end
Allow configs_for to accept a custom hash key
activerecord/lib/active_record/database_configurations.rb
の修正です。
先程の独自のhanlderを対応出来るようにした対応に合わせて、database configuration内のcustom hash keyをconfigs_for
メソッドに指定出来るよう修正しています。custom hash keyはconfig_key
オプションで指定出来るようになっています。合わせて、deprecatedになっていたconfigs_for
メソッドの:include_replicas
オプションを削除しています。
actionmailer/lib/action_mailer/test_helper.rb
の修正です。
enqueueされている全てのメールを送信する為のdeliver_enqueued_emails
メソッドをActionMailer::TestHelper
に追加しています。
def test_deliver_enqueued_emails deliver_enqueued_emails do ContactMailer.welcome.deliver_later end assert_emails 1 end
Deprecate initialize memcache store with dalli client
activesupport/lib/active_support/cache/mem_cache_store.rb
の修正です。
ActiveSupport::Cache::MemCacheStore#initialize
の最初の引数にDalli::Client
のインスタンスを指定出来るようになっていたのを、Dalli::Client
のインスタンスを指定出来るのをdeprecateにしています。ドキュメントには無い挙動(ドキュメント上は最初の引数に指定出来るのはmemcachedのaddressになっている)だったのですが、Dalli::Client
のインスタンスが指定されるとActiveSupport::Cache::MemCacheStore#initialize
に指定した他の引数(e.g. pool_size
)が無視されてしまい、混乱の元になる、という事でdeprecatedになっています。
Always write to debug.log in activerecord tests
activerecord/test/support/connection.rb
の修正です。
Active RecordのテストをCIで実行する際ログが出力されないようになっていたのを、必ずログを出力するよう修正してます。不安定テストの調査の為。
Replace call to BINARY with CAST(_ AS BINARY) (#47523)
activerecord/lib/arel/visitors/mysql.rb
の修正です。
MySQLでBINARY
operatorを使っていた箇所をCAST(... AS BINARY)
を使用するよう修正しています。BINARY
operatorがMySQL 8.0.27でdeprecatedになった為。
参考: MySQL :: MySQL 8.0 Reference Manual :: 12.11 Cast Functions and Operators
Merge pull request #47488 from jkotchoff/rails-info-routes-layout-compaction
actionpack/lib/action_dispatch/middleware/templates/routes/_table.html.erb
の修正です。
/rails/info/routes
でrouteを表示する際に、長いroutesが改行して表示されるよう修正しています。
Merge pull request #47539 from fatkodima/pg-notice-receiver-capture-output
activerecord/test/cases/adapters/postgresql/postgresql_adapter_test.rb
の修正です。
SQLのwarningの出力内容をチェックするテストで、warningを正しく取得出来てなかったのを修正しています。
Install dartsass-rails when generating app with sass (#47545)
railtiesの修正です。
rails new
のcss
オプションにsass
を指定した場合、Gemfileにdartsass-rails
を追加するよう修正しています。
Merge pull request #47544 from skipkayhil/fix-delayed-job-tests-always-running
activejob/Rakefile
の修正です。
各adapter向けのテストを実行するrake taskで、delayed_job
でだけしか通らないテストがdelayed_job
以外のadapterで実行されないよう修正しています。