なるようになるブログ

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

rails commit log流し読み(2025/07/02)

2025/07/02分のコミットです。

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

activerecord/CHANGELOG.md


Implement deprecated associations

Active Recordの修正です。

associationsに対して、そのassociationsがdeprecatedかどうかを指定出来るよう修正しています。

has_many :posts, deprecated: true

deprecatedになっているassociationに対して処理(値の指定、取得等)が行われた場合、deprecatedである旨reportが行われるようになっています。reportのmodeは、デフォルトは:warnで、Active Record logger経由でログを出力するようになっています。modeは:warn以外に、:raise(ActiveRecord::DeprecatedAssociationErrorをraiseする)、:notify(Active Support notificationsをpublish)をconfigで指定出来るようになっています。また、configでは、reportする際にbacktraceを含むかどうかも指定出来るようになっています。

config.active_record.deprecated_associations_options = { mode: :notify, backtrace: true }

Merge pull request #55249 from thisismydesign/patch-2

railties/lib/rails/generators/rails/app/templates/config/environments/production.rb.ttの修正です。

rails newで生成されるproduction.rb内のcacheの設定について、すべてのpublicディレクトリ配下のファイルに対してmax-ageが1年になっていたのを、digestが指定されるassetsのみ1年にし、それ以外のファイル(e.g. robots.txt, sitemap.xml)については、max-ageを1分 + stale-while-revalidateを5分とするよう修正しています。


RDoc markup fix

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

Active Record Associationsのdoc内のフォーマットを修正しています。


Delete extra blank line

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

不要な空行を削除しています。