なるようになるブログ

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

rails commit log流し読み(2014/11/03)

2014/11/03分のコミットです。

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

activerecord/CHANGELOG.md

activesupport/CHANGELOG.md


Pass the SelectManager, rather than the AST when querying w/ Relation

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

RelationHandlerクラスで、attributeへの引数にASTを渡していたのをSelectManagerを渡すよう修正しています。

性能的にが良いのでそうしたようなのですが…。 詳細良く解らず。


Deprecate sanitize_sql_hash_ methods on ActiveRecord

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

sanitize_sql_hash_for_conditionssanitize_sql_hash_for_assignmentメソッドをdeprecateにしています。

もう使用していない為deprecateにしたとの事なのですが、sanitize_sql_hash_for_assignmentはまだ使用していたらしく、Revertされています。


Revert deprecation of sanitize_sql_hash_for_assignment

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

Revertとなっているのですが、sanitize_sql_hash_for_assignmentのdeprecate対応だけを削除し、sanitize_sql_hash_for_conditionsは変わらずdeprecate対象です。

sanitize_sql_hash_for_assignmentupdate_allメソッドで使用していたとの事です。


Handle RangeError from casting in find_by and find_by! on Relation

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

find_byfind_by!メソッドでRangeErrorが発生した場合の対応を追加しています。

find_bynilを、find_by!RecordNotFoundをraiseしなおすよう対応しています。


Add an assert_deprecated for sanitize_sql_hash_for_conditions

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

sanitize_sql_hash_for_conditionsのテストで、deprecateメッセージが表示される事のテストを追加しています。


Revert "Replace String index juggling with Pathname goodness in db:fixtures:load"

activerecord/lib/active_record/railties/databases.rake

このコミットをrevertしています。

db:fixtures:loadタスクで、fixturesを読み込み処理の改善を行っていたのですが、この対応によりnamespaced fixturesのloadが出来なくなってしまっていた為、revertしています。


Add comment to point out String#[] is intentional

activerecord/lib/active_record/railties/databases.rakeの修正です。

上記revert対応した処理について、namespaced fixturesに対応するため現状の処理になっている旨コメントを追加しています。


Avoid unnecessary allocations/calls

コンポーネントの修正です。

不要なto_aメソッドの削除、values.eachを使用していた箇所をeach_valueへ修正しています。不要なインスタンス生成処理を避けるためですね。


Merge pull request #17383 from rwz/string-remove

activesupport/lib/active_support/core_ext/string/filters.rbの修正です。

String#removeString#remove!複数の引数を受け取れるよう対応しています。

"This is a good day to die".remove(" to ", /die/)
# => "This is a good day"