なるようになるブログ

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

rails commit log流し読み(2020/10/27)

2020/10/27分のコミットです。

CHANGELOGへの追加はありませんでした。


Show outstanding migrations when the PendingMigration error is raised. This will give users feedback on which migration is outstanding.

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

PendingMigrationが発生した際に、pendingになっているmigration名を表示するよう修正しています。


Merge pull request #40204 from jhawthorn/helper_module_copy_on_write

actionpack/lib/abstract_controller/helpers.rbactionview/lib/action_view/test_case.rbの修正です。

アプリ側で明示的にhelperの変更を行わない場合、不要なhelper用のmoduleを作成しないよう修正しています。オブジェクトの生成を減らすようにする為。


String#unicode_normalize is a public method

activesupport/lib/active_support/multibyte/chars.rbの修正です。

publicメソッドを呼び出すのにsendを使用していたのを、直接メソッドを呼び出すよう修正しています。


AS::Multibyte::Chars#reverse and tidy_bytes are public methods

activesupport/lib/active_support/multibyte/chars.rbの修正です。

public methodsを呼び出すのにsendを使用していたのを、public_sendを使用するよう修正しています。


before_save and after_save in this test class are defined as public methods

activesupport/test/callbacks_test.rbの修正です。

public methodsを呼び出すのにsendを使用していたのを、public_sendを使用するよう修正しています。


*_digest is defined as a public method

activemodel/lib/active_model/secure_password.rbの修正です。

public methodsを呼び出すのにsendを使用していたのを、public_sendを使用するよう修正しています。


These test model accessors are public methods

activemodel/test/models/contact.rbactivemodel/test/models/topic.rbの修正です。

public methodsを呼び出すのにsendを使用していたのを、public_sendを使用するよう修正しています。


Mapper#resource and resources are both public methods

actionpack/lib/action_dispatch/routing/mapper.rbの修正です。

public methodsを呼び出すのにsendを使用していたのを、public_sendを使用するよう修正しています。


Module#attr_reader/writer are public methods since Ruby 2.5

activesupport/lib/active_support/core_ext/module/attr_internal.rbの修正です。

public methodsを呼び出すのにsendを使用していたのを、public_sendを使用するよう修正しています。


class_attributes are defined as public methods

actionmailer/lib/action_mailer/delivery_methods.rbの修正です。

public methodsを呼び出すのにsendを使用していたのを、public_sendを使用するよう修正しています。


Methods defined per Action View templates are public methods

actionview/lib/action_view/base.rbの修正です。

public methodsを呼び出すのにsendを使用していたのを、public_sendを使用するよう修正しています。


Remove unused internal methods in ActiveModel::Attributes

activemodel/lib/active_model/attributes.rbの修正です。

ActiveModel::Attributes内の使用していないメソッドを削除しています。


Use attribute_before_type_cast in the internal

Active Recordの修正でs.

type cast前のattributeを取得するのに、read_attribute_before_type_castを使用していたのを、attribute_before_type_castを使用するよう修正しています。

Fix read_attribute_before_type_cast to consider attribute aliasesの対応により、read_attribute_before_type_castattribute_before_type_castより遅くなっている為。


Merge pull request #40414 from Shopify/handle-frozen-paylaods

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

ActiveRecord::Type::Serializedのencode処理で、encodingの設定前に、値がfreeze済みの場合dupしてからencodingの設定を行うよう修正しています。


Merge pull request #40457 from HParker/specify-per-param-encoding

Action Packの修正です。

controllerで、actionのparam毎にencodingを指定出来るよう対応しています。encodingの指定はparam_encodingメソッドで行えるようになっています。

class RepositoryController < ActionController::Base
  # `file_path`のencodingを`Encoding::ASCII_8BIT`にする
  param_encoding :show, :file_path, Encoding::ASCII_8BIT

  def show
    @repo = Repository.find_by_filesystem_path params[:file_path]

    # params[:repo_name]は`UTF-8`のまま
    @repo_name = params[:repo_name]
  end
end