なるようになるブログ

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

rails commit log流し読み(2022/07/19)

2022/07/19分のコミットです。

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

actionpack/CHANGELOG.md

activestorage/CHANGELOG.md


Merge pull request #45570 from whyinzoo/whyinzoo-update-docs-ActiveSupport--EncryptedFile-read-for-pr

activesupport/lib/active_support/encrypted_file.rbのdocの修正です。

ActiveSupport::EncryptedFile#readメソッドにdocを追加しています。


Prevent ActionDispatch::ServerTiming from overwriting existing header

actionpack/lib/action_dispatch/middleware/server_timing.rbの修正です。

ActionDispatch::ServerTiming middlewareでServer-Timing headerを設定する際に、既にServer-Timing headerが設定されている場合、値を上書きではなく追加するよう修正しています。


Fix QueryMethods#in_order_of for non-integer columns in MySQL

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

MySQL adapterで、QueryMethods#in_order_ofにinteger column以外のcolumnを指定出来るよう修正しています。


Clear JobBuffer on teardown

activejob/test/support/job_buffer.rbの修正です。

テストの後処理でjobのデータをclearするよう修正しています。


Speedup ActionView::OutputBuffer

Action Viewの修正です。

ActionView::OutputBufferActiveSupport::SafeBufferのsubclassにしないよう修正しています。Ruby本体が行っているstring concatenationの最適化処理はStringのsubclassの場合使用されないようになっており、その最適化処理が使われるようにする為。


Fix granular swapping for primary_abstract_class

Active Recordの修正です。

establish_connectionを呼び出した際にconnectionを使いまわすよう修正した、Only remove connection for an existing pool if the config is differentの影響で、primary_abstract_classとのconnectionのswappingが正しく動作しなくなっていたのを修正しています。


Allow to use pre-defined variants for previews

activestorage/app/models/active_storage/attachment.rbの修正です。

attachmentのpreviewrepresentationメソッドを実行する際に、ユーザが同時に定義したvariant処理が実行されるよう修正しています。

class User < ActiveRecord::Base
  has_one_attached :file do |attachable|
    attachable.variant :thumb, resize_to_limit: [100, 100]
  end
end

<%= image_tag user.file.representation(:thumb) %>