2023/03/10分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
activemodel/CHANGELOG.md
Enhance has_secure_password to also generate a password_salt method https://github.com/rails/rails/commit/ebe9e575b7691c6a04abfadfedfb55516eb63e47
activemodel/lib/active_model/secure_password.rb
の修正です。
has_secure_password
メソッドを使用している場合に、password digestの計算に使用する為のsaltを返す#{attribute}_salt
を使用出来るよう修正しています。
class User < ActiveRecord::Base has_secure_password generates_token_for :password_reset, expires_in: 15.minutes do password_salt&.last(10) end end
Use Thor for built-in secret task
railties/lib/rails/commands/secret/secret_command.rb
、
railties/lib/rails/tasks/misc.rake
の修正です。
secret
コマンドを実装するのにrake taskを使用していたのを、Thor
を使用するよう修正しています。
Define ActiveRecord::Base#id
API for composite primary key models
Active Recordの修正です。
composite primary keyを使用している場合に、ActiveRecord::Base#id
メソッドが全てのprimary keyのcolumnを返すよう修正しています。
class Order < ActiveRecord::Base self.primary_key = [:shop_id, :id] end
order = Order.create!(shop_id: 1, id: 2) order.id # => [1, 2]