なるようになるブログ

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

rails commit log流し読み(2015/09/26)

2015/09/26分のコミットです。

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

actionview/CHANGELOG.md

activejob/CHANGELOG.md


Merge pull request #21738 from cllns/remove-to_s-from-example

rails guideのGetting Started with Enginesの修正です。

Using a Model Provided by the Applicationの項、engineを使用したサンプルアプリについて説明している箇所で、modelのto_sメソッドをオーバーライドして値を返す、という処理が記載されているのですが、 既存のメソッドをオーバーライドする事についての説明は、engineのガイドの範囲外だろうという事で、説明を削除しています。


docs, add missing closing bracket. [ci skip]

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

groupメソッドのdoc内のexampleの実行結果に閉じ括弧が足りてなかったのを追加しています。


fix Mime type in doc since mime types via constants is deprecated [ci skip]

actionpack/lib/action_dispatch/http/mime_types.rbactionpack/test/dispatch/mime_type_test.rbの修正です。

deprecateになったmime typeを定数から取得する処理を使用している箇所があったのを、Mime::Type経由で値を取得するよう修正しています。


Added missing tests for transform_values! which returns Enumerator without blocks

activesupport/test/core_ext/hash/transform_values_test.rbの修正です。

transform_values!メソッドにブロックを渡さなかった場合のテストが無かったので、追加しています。


Added missing tests for transform_keys! which returns Enumerator without block

activesupport/test/core_ext/hash/transform_keys_test.rbの修正です。

transform_keys!メソッドにブロックを渡さなかった場合のテストが無かったので、追加しています。


Fixed humane -> human [ci skip]

activemodel/lib/active_model/naming.rbのdocの修正です。

humanメソッドのdocでhumanhumaneにタイポしていたのを修正しています。


move flash committing to the request object.

actionpack/lib/action_dispatch/http/request.rbactionpack/lib/action_dispatch/middleware/flash.rbの修正です。

Flashクラスで行っていたsession objectへのflashデータの確定処理を、request objectで行うよう処理を移動しています。

session objectへの処理は、flash middlewareが行うべき処理では無い、という事で移動させたようです。


commit the flash after the controller finishes being serviced

Action Packの修正です。

flashの確定処理を、controllerの一連の処理終了後に行うよう、処理を行うタイミングを移動しています。


make sure flash middleware is required

railties/test/isolation/abstract_unit.rbの修正です。

TestHelpers moduleでflash middlewareのrequireを確実に行うよう、action_dispatch/middleware/flashのrequireを追加しています。


pull the flash methods in to their own module

actionpack/lib/action_dispatch/http/request.rbactionpack/lib/action_dispatch/middleware/flash.rbの修正です。

flashに関する処理をmoduleに移動し、ユーザが有効化した場合のみ読みこむよう対応、及び大本のrequest objectには、実装が空のcommit_flashメソッドを追加しています。

API-only Applicationsのように、flashを使用しない場合もある為、対応したとの事です。


inherit from our AbstractStore

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

CookieStoreクラスの親クラスをRack::Session::Abstract::PersistedからAbstractStoreに移動してます。

AbstractStoreクラスは、各種store処理を行うクラス(CacheStoreMemoryStore)の、親クラスようクラスの為のようです。


Correcting ActiveRecord::ReadOnlyRecord Error Message [ci skip]

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

readonlyメソッドのdocで、readonlyが設定したオブジェクトをsaveした場合に起こるエラーのexampleが、実際の内容と異なっていたのを修正しています。


nodoc the mutation trackers

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

内部用クラスであるAttributeMutationTrackerNullMutationTracker:nodoc:を追加しています。


Merge pull request #18303 from maurogeorge/collection_radio_buttons_hidden_field

Action Viewの修正です。

collection_radio_buttonsメソッドを使用した場合に、自動でhidden_fieldメソッドも呼び出すよう修正しています。

collection_radio_buttonsのみを使用、かつ、ユーザがそのradio buttonから何も選択しなかった場合、ブラウザはそのradio buttonに関する情報を何も送信しません。

その為collection_radio_buttonsだけを使用している場合に、フォームに関する情報が送信されず、StrongParameterでparamsのpermit処理を行った際に、ActionController::ParameterMissinが発生しまう為、それを避ける為に、強制的にhidden_fieldを挿入し、必ずパラメータが送信されるよう対応したとの事です。


Merge pull request #19425 from wvengen/feature/activejob-priority-master

Active Jobの修正です。

Active Jobで作成するjobに、prioritiesを設定出来るよう対応しています。

priorityはsetメソッドで設定、又はクラスメソッドqueue_with_priorityで設定可能です。

例。

VideoJob.set(queue: :some_queue, wait: 5.minutes, priority: 10).perform_later(Video.last)
class PublishToFeedJob < ActiveJob::Base
  queue_with_priority 50

  def perform(post)
    post.to_feed!
  end
end

Fix ActiveRecord::PredicateBuilder docs. as register_handler no more ClassMethod, Since commit https://github.com/rails/rails/commit/a3936bbe21f4bff8247f890cacfd0fc882921003 [ci skip]

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

register_handlerメソッドChange PredicateBuilder handler methods to instance methodsインスタンスメソッドに変更されたのですが、doc無いにあったexampleがクラスメソッドだった場合のままになっていたので、インスタンスメソッドとして扱うよう修正しています。


Merge pull request #21431 from ojab/master

actionview/lib/action_view/helpers/form_helper.rbの修正です。

fields_forメソッドをネストしてしようしていた場合に、レコード名が正しく生成されないバグがあったのを修正しています。


column_alias_for method is no more supporting *keys [ci skip]

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

column_alias_forメソッドのdocのexampleに、keyを複数指定した場合のexampleがあったのですが、stop passing *args to generate aliases でkeyの複数指定はサポートしなくなったので、exampleを削除しています。


minor typo fix [ci skip]

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

TimeWithZoneクラスのdoc内のTime.zone.atを使用した場合のexampleで、docに書かれている内容と実際の結果が異なる箇所があったのを修正しています。


Merge pull request #21777 from aditya-kapoor/minor-time-fix


Correcting ActiveRecord::DangerousAttributeError error message [ci skip]

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

instance_method_already_implemented?メソッドのdoc内、ActiveRecord::DangerousAttributeErrorエラーについてのexampleで、docに書かれている内容と実際の結果が異なる箇所があったのを修正しています。


Fix typo in configuration test descritive > descriptive [ci skip]

railties/test/application/configuration_test.rbの修正です。

descriptivedescritiveにタイポしている箇所があったのを修正しています。


Added test cases where collection partial cached for different key and rendered for different key

actionview/test/template/render_test.rbの修正です。

カスタムキーでキャッシュを行い、かつ、違うキーでレンダリング処理を行った場合のテストを追加しています。