なるようになるブログ

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

rails commit log流し読み(2017/08/16)

2017/08/16分のコミットです。

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

railties/CHANGELOG.md


Don’t expose write_attribute_without_type_cast

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

AttributeMethods::Dirty#write_attribute_without_type_castの可視性をpublicからprivateに変更しています。

オーバーロード元であるAttributeMethods::Write#write_attribute_without_type_castメソッドはprivateになっており、元の可視性を維持する為。


Add system_test logs to guide [ci skip]

rails guideのGetting Started with EnginesCreating and Customizing Rails Generators & Templatesの修正です。

scaffold generatorの実行例に、system testの実行例が含まれていない箇所があったのを修正しています。


minor tweaks in Active Storage after a walkthrough

Active Storage の修正です。

各docのフォーマット、グラマーの修正。及び不要な改行の削除等を行っています。

が、不要と思われた改行は意図的だった為、後ほど再度修正しています。


Merge pull request #30261 from bogdanvlviv/improve-guides-plugins

rails guideのThe Basics of Creating Rails Pluginsの修正です。

exampleコードのフォーマットの整理及び使用するメソッドの改善、その他リンクの修正等ガイド全体の見直しを行っています。


Add –skip-yarn option to the plugin generator

railties/lib/rails/generators/rails/plugin/plugin_generator.rbrailties/lib/rails/generators/rails/plugin/templates/gitignoreの修正です。

plugin generatorに--skip-yarnオプションを指定出来るよう修正しています。


Merge pull request #30271 from kamipo/through_scope_should_not_be_affected_by_scoping

Active Recordの修正です。

scopingで本来参照されないべきのhas_many through先のscopeが参照されてしまうバグがあったのを修正しています。


restores some double newlines deleted in ae87217

Active Storageの修正です。

minor tweaks in Active Storage after a walkthrough で誤って削除してしまった改行を戻しています。メソッド群の区切りの為に改行を2つ意図的に入れているとの事です。


Merge pull request #30045 from albertoalmagro/fix-raise-unpermitted-parameters-regression

actionpack/lib/action_controller/railtie.rbactivesupport/lib/active_support/lazy_load_hooks.rbの修正です。

ActiveSupport::LazyLoadHooks#on_loadメソッドに、処理を一度だけ行いたい時ようのrun_onceオプションを追加しています。

ActiveSupport.on_load(:action_controller, run_once: true) do
...
end

上記のように指定した場合、on_load hookが複数回呼ばれても、ブロックは一度だけしか実行されないようになります。

合わせて、action_controlleron_load hookにrun_onceオプションを指定するよう修正しています。


Add test case to make sure Parameters configuration are executed once

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

ActionController::APIのload処理が呼ばれるよう各テストに処理を追加しています。

ActionController::BaseActionController::APIそれぞれのload処理が呼ばれた際に、on_loadブロックが一度しか呼ばれない事(先のコミットでrun_onceオプションを指定している為)を確認する為。


Fix test “_before_type_cast” for enum (#29004)

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

_before_type_castメソッドについてのテストに、enumの値を指定した前後の状態でのテストを追加しています。

Refactor enum to be defined in terms of the attributes API_before_type_castの挙動が変更されており、その変更内容を確認する為にテストも変更しています。


Fix RuboCop offenses

EnforcedStyle: context_dependent copを使用するよう.rubocop.ymlを修正、及び、各ファイルに先copを適応しています。


Change namespace of Active Storage rake task

activestorage/lib/tasks/activestorage.rakeの修正です。

Active Storageのrake taskのnamespaceをactivestorageからactive_storageに修正しています。

Active Storageのmigrationをインストールするrake taskのnamespaceがactive_storageになっており、それと合わせる為。


Remove period from within links

rails guideのRuby on Rails Security Guideの修正です。

Additional Resourcesの項、リンクの中にピリオドが含まれていたのを、ピリオドはリンクの外(aタグの外)に入れるよう修正しています。


Change to plural

rails guideのA Guide for Upgrading Ruby on Railsの修正です。

ActionView::Helpers::RecordTagHelperについて説明している箇所のグラマーの修正を行っています。


Small grammar fixes

rails guideのActive Record Callbacksの修正です。

Transaction Callbacksの項のグラマーの修正を行っています。