なるようになるブログ

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

rails commit log流し読み(2016/01/24)

2016/01/24分のコミットです。

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

activerecord/CHANGELOG.md


Document scoping issue with Time.use_zone

activesupport/lib/active_support/core_ext/time/zones.rbのdocの修正です。

Time::use_zoneメソッドのdocにexampleを追加、及び既に作成済みのインスタンスには設定したtimezoneは影響が無い旨noteを追加しています。


Use the database type to deserialize enum

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

enumを使用している場合に、DBのデフォルトに設定した値がインスタンスの初期化時に反映されないバグがあったのを修正しています。


Merge pull request #23102 from yui-knk/foreign_type_to_singular_association

Active Recordの修正です。

ActiveRecord::Associations::Builder::BelongsTo.valid_optionsActiveRecord::Associations::Builder::HasOne.valid_optionsそれぞれでoptionに:foreign_typeが定義されていたのを、 両方の親クラスであるActiveRecord::Associations::Builder::SingularAssociationvalid_optionsメソッドをで:foreign_typeを定義してしまうよう修正しています。


Add environment back to db:structure:load

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

db:structure:loadタスク実行時に、environmentを実行するよう修正しています。

元々は不要だったのですが、Prevent destructive action on production database by schneems · Pull Request #22967 · rails/railsの対応によりenvironmentの情報が必要になった為、修正したとの事です。


Split internal subscriber tracking from Postgres adapter

Action Cableの修正です。

ActionCable::SubscriptionAdapter::PostgreSQLクラスで行っていたsubscriberの処理を、別クラスActionCable::SubscriptionAdapter::SubscriberMapに切り出しています。


Normalize on no arguments for the success callback

actioncable/lib/action_cable/channel/streams.rbactioncable/lib/action_cable/subscription_adapter/redis.rbの修正です。

success callbackの呼び出し処理の引数を統一するよう修正しています。


Add Async and Inline adapters

actioncable/lib/action_cable/subscription_adapter/async.rbactioncable/lib/action_cable/subscription_adapter/inline.rbの修正です。

Action Cableのadaptersに、Action Job同様にActionCable::SubscriptionAdapter::Async及びActionCable::SubscriptionAdapter::Inline adapterを追加しています。developmentで使うようですかねえ。


Rails::Generators::Actions#gem should work even if frozen string is passed as argument

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

Rails::Generators::Actions#gemの引数にfrozen stringを渡した場合に、RuntimeError(can't modify frozen String)が発生してしまっていたのを対応しています。


Allow subscription adapters to be shut down

Action Cableの修正です。

Action Cableの各adapterにshutdownメソッドを追加しています。名前の通りで、処理終了時に必要な処理が定義しています。


Add tests for the ActionCable adapters

Action Cableの修正です。

Action Cableの各adapterに対するテストを追加しています。


Using a hacked faye-websocket, drop EventMachine

Action Cableの修正です。

EventMachineを使用していた箇所を、concurrent-rubyを使用するよう修正しています。

また、faye-websocket gem自体がEventMachineに依存していたので、concurrent-rubyを使用するよう改造した独自版のfaye-websocketを使用するようにしています。


Import the relevant portions of faye-websocket

Action Cableの修正です。

先で追加した独自版のfaye-websocketを使用するのを、止めてcelluloid/nio4r: New IO for Rubyを使用するよう全体的に修正しています。

元々faye-websocket gemに頼っていた箇所は、Action Cable内にfaye-websocketで行っていたのと同様の処理を行うクラスを追加し、対応しているようです。


Ditch the EM error logging helper

Action Cableの修正です。

EventMachineでエラーになった際にログを出力するよう設定していた処理を削除しています。


Pare back default index option for the migration generator

activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rbactiverecord/lib/active_record/migration/compatibility.rbの修正です。

migrationファイルでreferencesbelongs_toメソッドを使用した場合、自動でindex: trueが設定されるよう対応しています。

indexを設定したく無い場合は、index: falseオプションを明示的に指定する必要があります。


Bump mail gem constraint from [~> 2.5, >= 2.5.4] to ~> 2.6

actionmailer/actionmailer.gemspecの修正です。

mail gemのバージョンを2.6系を使用するよう修正しています。

mail gem 2.6.4でmime-types 3.0.0への対応が行われており、そちらを使用出来るようにする為、のようです。

が、mail gem 2.5系を使えなくする必要性は無いだろう、という事で、後ほどrevertされています。


Be consistent in testing outputs from railties test and use /bin/rails everywhere(the default behaviour now) instead of mix of /bin/rake /bin/rails everywhere

railtiesのテストの修正です。

テストの中で、bin/rakeを使用していた箇所をまとめてbin/railsコマンドを使用するよう修正しています。


Test files has to be named *_test.rb

Active Supportのテストの修正です。

テストの中に、ファイル名が*_test.rbになっていないファイルがあったので、*_test.rbにファイル名を修正しています。


:warning: mismatched indentations at 'end' with 'unless'

activesupport/test/multibyte_grapheme_break_conformance_test.rbactivesupport/test/multibyte_normalization_conformance_test.rbの修正です。

endのインデントがおかしくなっている箇所があったのを修正しています。


Put test-case dependent helper Class inside the test case

Active Supprtの修正です。

テスト無いで使用するhelper classがグローバルに定義されていたのを、各テストケースの中で定義するよう修正しています。

同じ名前のhelper class / methodで各テストファイルに定義されており、グローバルのままだと、既に定義である旨Rubyのワーニングが出てしまう為、のようです。


Merge pull request #23213 from Ferdy89/docs_format_contraints_with_glob

rails guideのRails Routing from the Outside Inの修正です。

Request-Based Constraintsの項に、format constraintを使用する場合のexample、及び注意事項を追記しています。