なるようになるブログ

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

rails commit log流し読み(2014/04/10)

2014/04/10日分です。ここ数日、コミット数が割と多くて少し大変なので、フォーマット作成用のアプリの作成を急がねば…。


depend_on_asset is not required anymore on sprockets-rails 2.1.2

sprockets-rails 2.1.2ではdepend_on_assetが不要になったので、テストコードからdepend_on_assetの記述を削除しています。

rails4.1から、cssファイルでhelperメソッド(image-url等)を呼び出す際、depend_on_assetを呼び出さないと動かなくなってしまっていたのを修正。

sprockets-railsのPRはこちら

影響範囲大きめ。


Add missing require so requiring active_support/cache works again.

active_support/per_thread_registry'requireが消されてしまったらしく、再度requireを追加しています。


Avoid URI parsing

redirect_to_httpsの処理の中で、request.uriの値をパースして、飛び先のlocationを組み立てていたのですが、元々requestオブジェクトに入っている値でlocationの組み立てが可能だった為、request.uriのパース処理が削除しています。


The source option for has_many => through should accept String values.

has_many => throughsourceオプションが元々Symbolしか受け付けて無かったのを、Stringも受け付けるよう修正しています。


add services: memcache to travis

travis.ymlの修正。servicesにmemcacheを追加しています。


Make the reflections cache work with strings as its keys

ActiveRecord::Reflectionにはcache機能があって、そのcacheのkeyにStringを指定するよう修正。

ActiveRecordReflection機能があるの自体初めて知りました。どういうユースケースで使うんだろう。


No need to call to_sym on reflection name, since the cache now works with strings with string keys.

上記コミットにより、cachekeyをStringで扱うにようになったので、不要になったto_symしている箇所を削除しています。


Make the aggregate_reflections cache work with strings as its keys.

まだReflection関係の修正。上記同様、keyにStringを使うよう修正


Make sure the reflection test is passing a String to the reflection cache.

まだまだReflection関係の修正。上記修正に伴うテストの修正。


Remove extra collect call

まだまだまだReflection関係の修正。不要なcollect処理削除。


Only call uniq on the conditional that actually needs it

まだまだまだまだReflection関係の修正。

-        (options[:source] ? [options[:source]] : [name.to_s.singularize, name]).uniq
+        options[:source] ? [options[:source]] : [name.to_s.singularize, name].uniq

演算結果にuniqを行うのではなう、uniq処理が必要な部分にだけ処理を行うように修正。


Active support callback's before/after/around filters are not correctly making their singleton methods private

クラスメソッドをprivate化するために、private_class_methodメソッドを使用するよう修正しています。

元々は、privateを定義していたのですが、これはインスタンスメソッドの場合はprivateになるのですが、クラスメソッドはprivateならないので、privateになってなかったバグの修正ですね。

割とありがちなバグなんですが、気付きづらいですね、これ。


EOL

不要な改行コードの削除。End Of Lineの略ですな。


Correct factual error for page not found

rails guideの修正。参考URLのアドレスが間違えてたのを修正しています。


Add a failing test for a URL helper that was broken by a6b9ea2.

testコードの追加。Add a failing testと書いてあるのですが、普通に通るテストのような…。どういうニュアンスなのか、ちょっと分からなかったです。このテストを見て、resourcesshallowオプションがあるのを思い出しました。shallowについてはこちら参考。


Isolate debugger related code

debuggerに関係するコード(テスト含む)を分離させて、関係ある処理でまとめています。こういうリファクタリング良いですね。あとで読むときに分り易くなりそうです。


Prevent generation of extra whitespace in templates

<%- ~ %>を使うようにして、generateで生成されるGemfileから余計な空白を取り除いくようにしています。


ci skip Update code snippets to latest master (initialization.md)

rails guideの修正。 Mongrelを使うように書かれていたexampleがPumaを使うように修正されています。