2016/02/13分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
actionpack/CHANGELOG.md
、activerecord/CHANGELOG.md
の修正です。
CHANGELOG内のexampleコードで、rake
コマンドを使用している箇所があったのをrails
コマンドを使用するよう修正しています。
[ci skip] Fix enqueuing spelling to maintain consistency
Active Jobのdocの修正です。
doc内でenqueueing
と記載していた箇所をenqueuing
を使用するよう修正しています。
enqueueing
が間違いという訳では無いのですが、module名にEnqueuing
を使用している為、enqueuing
を使用するよう統一したとの事です。
Use correct path in documentation.
docの修正です。
doc内でproduction.rb
のpathがconfig/production.rb
になってしまっている箇所があったのをconfig/environments/production.rb
にまとめて修正しています。
Flesh out request encoding + response parsing changelog entry.
actionpack/CHANGELOG.md
の修正です。
ActionDispatch::IntegrationTest
のbody parse処理についての詳細な説明を追加しています。
Add fixes accidentally removed.
Action Packの修正です。
先日行われたActionDispatch::IntegrationTest
のbody parse処理に関するコミットで、諸々ミスがあったのをまとめて修正しています。
- [ci skip] Fix syntax error in CHANGELOG example. · rails/rails@3b94c38 で
post
メソッドを使用したexampleコードから、post
メソッドの引数に必要なparams
キーを削除してしまったのを戻しています。 - [ci skip] Mention
parsed_body
in docs. · rails/rails@5007df5でdoc内のresponse_parser
メソッドについて説明している箇所から、必要な説明を誤って削除してしまったのを戻しています。 - Memoize
parsed_body
. · rails/rails@036a7a0でparsed_body
の値をメモ化していたのを誤って削除していたのを、再度メモ化するよう修正しています。
Merge pull request #23611 from abhishekjain16/routes_options
actionpack/lib/action_dispatch/routing/inspector.rb
の修正です。
rails routes
タスクの-g(grep)
オプションでgrepする対象がcontrollerとactionだけだったのを、verb、name、pathもgrepするよう修正しています。
use kwargs to avoid hash slicing
actionview/lib/action_view/digestor.rb
の修正です。
ActionView::Digestor.new
メソッドの引数がoptions
hashだけだったのを、必須パラメータ(name
、finder
)はキーワード引数を使用するよう修正しています。
use assert_not_equal so there will be better error messages
actionview/test/template/digestor_test.rb
の修正です。
値が一致しない事を確認するテストのassertionにassert
を使用していたのを、assert_not_equal
を使用するよう修正しています。assert_not_equal
を使用した方が、エラーになった際のエラーメッセージがわかりやすい為、との事です。
- assert previous_digest != digest(template_name, options), "digest didn't change" + assert_not_equal previous_digest, digest(template_name, options), "digest didn't change"
Don't search in locals for cache_options.
actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb
の修正です。
ActionView::CollectionCaching.fetch_or_cache_partial
メソッドでcache_options
をlocalsから取得していたのを止めてします。
top levelのcache_options
のみサポートしている為、との事です。
Remove single_template_render? method.
actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb
の修正です。
@template
を返すだけのsingle_template_render?
メソッドを削除し、直接@template
を参照するよう修正しています。
use a real LookupContext in the digest tests
actionview/test/template/digestor_test.rb
の修正です。
digestのテストで、templateのfind処理をテスト用の独自実装で行っていたのを、ActionView::LookupContext
を使用するよう修正しています。
the lookup context looks in the cwd, so prefix isn't necessary
actionview/test/template/digestor_test.rb
の修正です。
FixtureFinder.new
メソッドでActionView::LookupContext
のインスタンスを生成する際、prefixは指定しないよう修正しています。
cwdで処理を行う際はprefixは不要な為。
Test collection caching with callable cache key.
actionpack/test/controller/caching_test.rb
の修正です。
cache keyにProcを指定した場合にcollection cachingが正しく行われる事のテストを追加しています。
Remove useless callable_cache_key? check. https://github.com/rails/rails/commit/61b03f37d8117c71ede59b335e493fd8016c414a
actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb
の修正です。
ActionView::CollectionCaching.automatic_cache_eligible?
メソッドからcallable_cache_key?
のチェック処理を削除しています。
automatic_cache_eligible?
が呼ばれるのが@options
から:cache
keyが取得出来なかったときだけで、その場合callable_cache_key?
は必ずfalseになる為、チェックする必要が無い為、との事です。
railties/lib/rails/generators/rails/plugin/templates/app/controllers/%namespaced_name%/application_controller.rb.tt
の修正です。
application_controller.rb
のテンプレートファイルで、protect_from_forgery
メソッドの引数の指定にRuby 1.9のHash記法を使用するよう修正しています。
Check partial_rendered_times
to clarify expectations.
actionpack/test/controller/caching_test.rb
の修正です。
cacheから値を読み込んだ際に順序が保持されている事を確認するテストで、partial_rendered_times
の値もチェックするよう修正しています。
Only write to collection cache if we have a callable cache key.
actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb
の修正です。
ActionView::CollectionCaching.fetch_or_cache_partial
メソッドで呼び出し可能なcache keyを保持している場合のみ、collection cacheの書き込みを行うよう修正しています。
Write to collection cache where the template is rendered.
actionview/lib/action_view/renderer/partial_renderer.rb
、
actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb
の修正です。
collection cacheの書き込み処理をtemplateのrender処理を行っているメソッドと同じメソッドで呼び出すよう修正しています。
local template 変数にアクセスしている処理をまとめるためのようです。
Inline fetch_or_cache_partial
.
actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb
の修正です。
partialのcacheまたはfetch処理を行うfetch_or_cache_partial
メソッドを削除し、メソッドで行っていた処理は呼び出し元でそのまま行ってしまうよう修正しています。
actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb
の修正です。
rendered partialsの値を取得するのにdup
+ shift
を使用していたのを、indexを指定し取得するよう修正しています。
- rendered_partials = @collection.any? ? yield.dup : [] + rendered_partials = @collection.any? ? yield : [] + index = 0 keyed_collection.map do |cache_key, _| cached_partials.fetch(cache_key) do - rendered_partials.shift + rendered_partials[index].tap { index += 1 } end
rendered_partials
はArrayであり、参照する為に値を変異させる必要は無い為、
actionview/lib/action_view/renderer/partial_renderer/collection_caching.rb
の修正です。
cache_collection_render
メソッドで、collectionに値があるかどうかチェックするのにany?
を使用していたのを、empty?
を使用するよう修正しています。
- rendered_partials = @collection.any? ? yield : [] + rendered_partials = @collection.empty? ? [] : yield
不要なループ処理を減らす為のようです。
railties/test/generators/plugin_generator_test.rb
の修正です。
Use Ruby 1.9 hash syntaxでapplication_controller.rb
のテンプレートファイルで、protect_from_forgery
メソッドの引数の指定にRuby 1.9のHash記法を使用するよう修正したのですが、テストのほうの修正が漏れていた為、テストについても同様に修正しています。
push kwargs up to the user facing API
Action Viewの修正です。
ActionView::Digestor.new
メソッドの引数にキーワード引数を使用していたのをやめて、ユーザが実際に使用するAPI(ActionView::Digestor.digest
メソッド)の引数にキーワード引数を使用するよう修正しています。
Make ActiveRecord::Relation#last to reverse SQL order
Active Recordの修正です。
Revert "Merge pull request #16400 from bogdan/last-with-sql" でrevertされたActiveRecord::Relation#last
のリファクタリングを再度コミットしています。
- relationがロード済みの場合、SQLは発行せずロード済みの値を使用するよう修正
- relationにlimitを指定していない場合、relationをロードせずreverse order SQLを使用するよう修正
- 自動的にreverse出来ないようなSQLを発行するのはdeprecateになった(Rails 5.1では
ActiveRecord::IrreversibleOrderError
がthrowされる)
CHANGELOより。
Topic.order("title").load.last(3) # before: SELECT ... # after: No SQL Topic.order("title").last # before: SELECT * FROM `topics` # after: SELECT * FROM `topics` ORDER BY `topics`.`title` DESC LIMIT 1 Topic.order("coalesce(author, title)").last # before: SELECT * FROM `topics` # after: Deprecation Warning for irreversible order
Add the missing author name [ci skip]
activerecord/CHANGELOG.md
の修正です。
Allow joins
to be unscoped. の対応のentryで対応者名が記載されてなかったので、追記しています。
docの修正です。
冠詞にan
を使うべきところでa
を使ってしまっていた箇所を、まとめてan
に修正しています。
add missing name option to flash test example [ci skip]
rails guideのA Guide to Testing Rails Applications
の修正です。
Testing flash notices
の項で、テスト名を指定してテストを実行するexampleで、オプション(-n
)の指定が漏れていたのを追加しています。