なるようになるブログ

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

rails commit log流し読み(2020/07/06)

2020/07/06分のコミットです。

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

activerecord/CHANGELOG.md

actionpack/CHANGELOG.md


Remove references to WARNINGS environment variable [ci skip]

guides/Rakefile、及び、rails guideのRuby on Rails Guides Guidelinesの修正です。

refactors and fixes in guides generation [ci skip]で削除されたWARNINGS envを指定、及び、説明している箇所を削除しています。


Support where with comparison operators (>, >=, <, and <=)

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

whereにcomparison operators (>, >=, <, と <=)を指定出来るよう対応しています。

posts = Post.order(:id)
posts.where("id >": 9).pluck(:id)  # => [10, 11]
posts.where("id >=": 9).pluck(:id) # => [9, 10, 11]
posts.where("id <": 3).pluck(:id)  # => [1, 2]
posts.where("id <=": 3).pluck(:id) # => [1, 2, 3]

type castingとtable / column名の解決をより正確に出来る為、where("create_at >= ?", time)よりも、新しく追加されたwhere("create_at >=": time) を使用するのが推奨されるようになっています。


Consolidate stringify keys in PredicateBuilder

activerecord/lib/active_record/relation/predicate_builder.rbactiverecord/lib/active_record/relation/query_methods.rbの修正です。

PredicateBuilderでHashのkeyにStringを使用するよう統一しています。


Resolve attribute alias for counter cache column

activerecord/lib/active_record/associations/has_many_association.rbactiverecord/lib/active_record/reflection.rbの修正です。

counter cacheのcolumnにalias attributeを指定出来るよう対応しています。


Change default HTTP status to 308 for ActionDispatch::SSL.

Action Pack、railtiesの修正です。

GET/HEAD以外のrequestをHTTPからHTTPSにリダイレクトした際のHTTP statusのデフォルトを308に変更しています。RFC 7538に準ずる為。

参考: RFC 7538 - The Hypertext Transfer Protocol Status Code 308 (Permanent Redirect)