なるようになるブログ

読書感想文かrailsについてかrubyについてか

rails commit log流し読み(2019/08/08)

2019/08/08分のコミットです。

CHANGELOGにのったコミットは以下の通りです。

activestorage/CHANGELOG.md

activerecord/CHANGELOG.md


Fixed cache_store name used in adding other modules section of api app documentation. [ci skip]

rails guideのUsing Rails for API-only Applicationsの修正です。

mem_cache_storemem_cached_storeにタイポしていたのを修正しています。


Fix typo in test name

activerecord/test/cases/calculations_test.rbの修正です。

quotedqoutedにタイポしていたのを修正しています。


Fix test schema loading for multi-db

activerecord/lib/active_record/migration.rbの修正です。

pending migrationがあるかどうかをチェックの複数DBで正しく動作しないバグがあったのを修正しています。


Add CHANGELOG entry for ActiveJob change

activejob/CHANGELOG.mdactivejob/lib/active_job/test_helper.rbの修正です。

perform_enqueued_jobsメソッドにatオプションを指定出来るようにした、Add at option to perform_enqueued_jobs test helperについてCHANGELOGにエントリーを追加、及び、assert_enqueued_jobsから使用していないatオプションを削除しています。


Correct the assertion argument order

actionmailbox/test/unit/test_helper_test.rbの修正です。

assert_equalメソッドの引数が逆(actual、expectedの順になっていた)になっていたのを修正しています。


Pass optional record in blob finder methods

activestorage/app/models/active_storage/blob.rbactivestorage/lib/active_storage/attached/changes/create_one.rbの修正です。

blob findersにrecordを渡せるよう修正しています。

シャーディングを使用出来るようにする為(シャードするモデルを指定出来るようにする為)、との事です。

使用例。

ActiveSupport.on_load(:active_storage_blob) do
  include ShardedBlob
end

module ShardedBlob
  extend ActiveSupport::Concern
  included do
    def self.find_signed(id, record:)
      find_by!(id: ActiveStorage.verifier.verify(id, purpose: :blob_id), shard_id: record.shard_id)
    end
    # ...
  end
end

Ensure custom PK types are casted in through reflection queries

activerecord/lib/active_record/reflection.rbの修正です。

primary keyをカスタマイズ(uuid、string等を使用)している、かつ、has_many through assertionを使用してthroughするassociationを明示していない場合に、NotImplementedErrorをraiseするよう修正しています。先のような状態だとassocation先が正しく取得出来ない(throughするassocationを明示する必要がある)為。


Updated to add Derailed link

rails guideのDebugging Rails Applicationsの修正です。

Debugging Memory Leaksの項にDerailedへのリンクを追加しています。


Merge pull request #36848 from jhawthorn/type_error_on_resolve_connection

activerecord/lib/active_record/connection_adapters/connection_specification.rbの修正です。

resolve_connectionに不正な値を指定した場合に無限ループになってしまっていたのを、正しくexceptionをraiseするよう修正しています。


Remove feature policy initializer in API only apps

railties/lib/rails/generators/rails/app/app_generator.rbの修正です。

Feature Policy 用のinitializerをAPI-only Applicationでは削除するよう修正しています。APIモードではFeature Policyの機能はデフォルトでは動作しない為。