なるようになるブログ

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

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

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

CHANGELOGへの追加はありませんでした。


Prefer object/nil over true/false

activesupport/lib/active_support/message_verifier.rbの修正です。

先日追加されたActiveSupport::MessageVerifier#verifiedメソッドが、エラーが起きた際にnilを返すよう修正しています。

"true/false"を返すより、"object/nil"を返す方が判りやすく、使う方としても良いのでは、との事です。確かに、"object/false"を返すメソッドは基本的には見ないですよねえ。


Allow to unscope where conditions using arel_table with Symbol

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

unscope + whereの組み合わせを使用する際に、whereの条件にarel_table + Symbolを指定した際に正常に動作するよう修正しています。

ちょっとややこしいのですが、下記の用な使い方をしていた場合に、正常に動作していなかったとの事です。

DeveloperOrderedBySalary.where(Developer.arel_table[:name].eq('David')).unscope(where: :name).collect(&:name)

arel_tableにStringを指定した際は動作していたようです。

DeveloperOrderedBySalary.where(Developer.arel_table['name'].eq('David')).unscope(where: :name).collect(&:name)

Add some FIXME notes about documentation [ci skip]

activesupport/lib/active_support/message_verifier.rbのdocの修正です。

メソッドのコメントに、"FIXME: Document this method"を追加しています。


Refactor PredicateBuilder from singleton to instance

ActiveRecordの修正です。

PredicateBuilderクラスについて、singletonクラスで処理を行っていたのを、インスタンスを生成するように修正しています。

Arelからのtype cast処理を削除する為のリファクタリングの一貫との事です。


Clarify change to process helpers [ci skip]

rails guideのRuby on Rails 4.2 Release Notesの修正です。

Action ViewのNotable changesの項に、integration testのprocessメソッドの仕様の変更について追記しています。

パスを指定する際に、先頭にスラッシュが必要になっています。

# OK
get "/posts"

# NG
get "posts"

Fix typo [ci skip]

rails guideのRuby on Rails 4.2 Release Notesの修正です。

先のコミットにタイポがあったのを修正しています。


Action View is needed for DebugExceptions

actionpack/lib/action_dispatch/middleware/debug_exceptions.rbの修正です。

Action Viewのrequireを追加しています。DebugExceptionsクラスで必要な為との事。後で消す予定。


Refactor build_from_hash to convert dot notation to hash first

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

PredicateBuilder#build_from_hashメソッドリファクタリングです。最初にHashをドット表記に変換するよう修正しています。異なる形式のnested tableを同じ方法で扱えるようにする為、との事です。


require 'rake' before requiring Rake tasks

railties/lib/rails/tasks.rbの修正です。

require 'rake'を追加しています。処理の中でrakeメソッドを使用しているのですが、requireを行うのが不足していた為。


Merge pull request #17888 from mrgilman/dot-notation


Require missing association in test

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

不足していたrequire 'models/categorization'を追加しています。


Fix "nonexistent" typo in tests

"nonexistant" -> "nonexistent"に修正しています。タイポ。


remove useless methods

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

使用していないactually_destroyed?clear_destroy_stateメソッドを削除しています。


[ci skip] remove references to Numeric#from_now

rails guideのActive Support Core Extensionsの修正です。

存在しないNumeric#from_nowメソッドについて説明している箇所を削除しています。


skip test to get sqlite3_mem suite passing.

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

in-memory database の場合、threadが死んだ時のテストをスキップするよう修正しています。