なるようになるブログ

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

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

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

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

activerecord/CHANGELOG.md


Specify when to generate has_secure_token

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

has_secure_tokenメソッドにtokenを生成するcallbackを指定出来るよう修正しています。デフォルトは:createで、modelの初期化時にtokenを生成したい場合、on: :initializeを指定すれば良いようになっています。

class User < ApplicationRecord
  has_secure_token on: :initialize
end

Support include? and member? on composite primary key relations

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

composite primary keyを使用しているrelationに対するinclude?member?が動作するよう修正しています。