なるようになるブログ

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

rails commit log流し読み(2018/05/07)

2018/05/07分のコミットです。

CHANGELOGへの追加はありませんでした。


Remove test_match_p since Rails 6 requires Ruby 2.4.1 or newer

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

Regexp#match?メソッドのテストを削除しています。

元々はRailsが独自にRegexp#match?メソッドを定義していた為テストもあったのですが、Ruby 2.4.1以上をサポートする事になった際に独自のRegexp#match?メソッドは削除されたので、テストも不要となり削除しています。


Skip bootsnap contents in app:update task if bootsnap is not used

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

bootsnapを使用していない場合にapp:updateタスクでbootsnapに関するコンテンツを生成しないよう修正しています。


Fix output in routing.md [ci skip]

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

Overriding Named Route Parametersの項、url helperメソッドの実行結果が実際の内容と異なっていたのを修正しています。

rails commit log流し読み(2018/05/06)

2018/05/06分のコミットです。

CHANGELOGへの追加はありませんでした。


prefer File.write for bulk writes

File.openしてからwriteメソッドを使用してデータを書き込んでいたのを、File.writeを使用するよう修正しています。


Address CI failure due to non-deterministic query result

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

takeのテストで値を取得する際にwhereで条件を指定するよう修正しています。条件の指定が無いと期待しているのと異なるレコードを取得する可能性がある為。


Active Record postgresql documentation for bit string types corrected

rails guideのActive Record and PostgreSQLの修正です。

Bit String Typesの項のexampleコードでファイル名とmodel名が一致していなかったのを修正しています。


restores original intention in constants guide, reworded [ci skip]

rails guideのAutoloading and Reloading Constantsの修正です。

Remove confusion in the sentence [ci skip]で修正された、Class and Module Definitions are Constant Assignmentsの項のStringクラスについて説明している箇所の言い回しを再度修正しています。

修正後の内容だと本来行いたかった説明が正しくできていない為、らしい。

rails commit log流し読み(2018/05/05)

2018/05/05分のコミットです。

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

activerecord/CHANGELOG.md

railties/CHANGELOG.md


Fix logic on disabling commit callbacks

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

トランザクション内で、エラーが発生しているにも関わらず、commit callbackが実行されてしまうバグがあったのを修正しています。


Don't generate assets' initializer in app:update task if sprockets is skipped

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

app:updateタスクで、sprocketsを使用していない場合にconfig/initializers/assets.rbを生成しないよう修正しています。

rails commit log流し読み(2018/05/04)

2018/05/04分のコミットです。

CHANGELOGへの追加はありませんでした。


Minor edits to the Active Storage guide

rails guideのActive Storage Overviewの修正です。

各項のグラマー、フォーマットの修正を行っています。


Merge pull request #29955 from padi/update_actiondispatch_integration_docs

actionpack/lib/action_dispatch/testing/integration.rbのdocの修正です。

ActionDispatch::Integration::Session#processメソッドのdocにxhr、及び、asオプションについての説明を追加しています。


Remove confusion in the sentence [ci skip]

rails guideのAutoloading and Reloading Constantsの修正です。

Class and Module Definitions are Constant Assignmentsの項、 Stringクラスについて説明している箇所の言い回しを修正しています。


Fix #29632 - nil #path leads to NoMethodError in LoadError#is_missing?

activesupport/lib/active_support/core_ext/load_error.rbの修正です。

LoadErrorのpathがnilだった場合に、LoadError#is_missing?メソッドがNoMethodErrorを返してしまうバグがあったのを修正しています。

rails commit log流し読み(2018/05/03)

2018/05/03分のコミットです。

CHANGELOGへの追加はありませんでした。


Stream blobs from disk

activestorage/app/controllers/active_storage/disk_controller.rbの修正です。

ActiveStorage::DiskControllerでdisk serviceからファイルをダウンロードする際に、イベントストリームを使用してchunk単位でダウンロード出来るよう修正しています。イベントストリームの実装はActionController::Liveを使用しています。


Add support for prefetch-src directive

actionpack/lib/action_dispatch/http/content_security_policy.rbの修正です。

prefetch-src directiveのサポートを追加しています。


Partly revert "Use https with weblog URI" [ci skip]

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

weblog.rubyonrails.orgへのリンクをhttpsに修正した、Use https with weblog URIの対応で関係無いサイトへのリンクもhttpsに変更してしまっていたのを戻しています。


Use usual method definition instead of extracting args from array

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

Digestor#find_templateメソッドで引数をArrayとして受け取った後で引数を変数に代入していたのを、普通にメソッドの引数をArrayではなく個別の変数に変更しています。


Assert correct response body

activestorage/test/controllers/disk_controller_test.rbの修正です。

ActiveStorage::DiskControllerのテストで@response変数を直接参照していたのを、responseメソッド経由でアクセスするよう修正しています。そちらの方が推奨されている為、のはず。

rails commit log流し読み(2018/05/02)

2018/05/02分のコミットです。

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

activestorage/CHANGELOG.md


Partly revert #32289 to provide Rails' custom fallback in case

railties/lib/rails/command/spellchecker.rbの修正です。

suggestメソッドでDidYouMean::SpellCheckerが使用出来るかチェックし、使用出来ない場合はレーベンシュタイン距離で計算したサジェストを出すよう修正しています。

did_you_meanが存在しないケースがある(did_you_meanはbundled gemで、普通にアンインストール出来る)為。


require "active_support/test_case" is not supported since 53e877f7

activerecord/test/cases/arel/helper.rbactiverecord/test/cases/test_case.rbの修正です。

テスト用にactive_support/test_caseをrequireしていたのを、active_supportをrequireするよう修正しています。

test_orderactive_supportに定義されてしまっており、active_supportをrequireしないとtest_orderが参照出来ずエラーになってしまう為。


Fix typo in ActiveRecord test method name

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

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


Make sure that when serialing an just deserialized job arguments are there

activejob/lib/active_job/core.rbの修正です。

ActiveJob::Core#serializeメソッドでargumentsをserializeする際に、argumentsがserialize済みかどうかをチェックし、既にserialize済みの場合、そちらの値を使い回すよう修正しています。

一度serializeしたjobを再度serializeした場合に、元のargumentsが取得出来るようにする為。


More exercise test_remove_named_index

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

違う定義のnamed indexを削除しようとするとエラーになることを確認するテストを追加しています。


Merge pull request #32784 from jpawlyn/allow-belongs-to-create-for-new-record

activerecord/lib/active_record/associations/has_one_association.rbactiverecord/lib/active_record/associations/singular_association.rbの修正です。

belong_to associationのobjectをnew record(保存していないrecord)から作成しようとするとエラーになっていたのを、作成出来るよう修正しています。


Remove unnecessary require

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

不要なrubygemsのrequireを削除しています。


Remove unused assert_like from Arel::Test

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

使用していないassert_likeメソッドを削除しています。


Support streaming downloads from Google Cloud Storage

activestorage/lib/active_storage/service/gcs_service.rbの修正です。

Google Cloud Storageでstreaming downloadを使用出来るよう修正しています。

google-cloud-storage gem側でstreaming downloadのサポートが入った為、なのですが、そちらの対応自体georgeclaghornによるものでした。

参考:Facilitate partial file downloads


Use https with weblog URI

weblog.rubyonrails.orgへのリンクをhttpsに修正しています。

GitHub Pagesでカスタムドメインhttpsが使用出来るようになった為。

rails commit log流し読み(2018/05/01)

2018/05/01分のコミットです。

CHANGELOGへの追加はありませんでした。


Fix test: threads being nil in ensure

`activesupport/test/cache/behaviors/connection_pool_behavior.rb@の修正です。

connection_poolのテストでテストの先頭でthreads変数を初期化するよう修正しています。

元々はテストの処理中に初期化していたのですが、それだと、ActiveSupport::Cache.lookup_storeでエラーになった場合の後処理で問題になる(後処理でthreadsを使用している)為、初期化の箇所を修正しています。


Fix an oxford comma

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

カンマのフォーマットを、oxford comma形式に修正しています。


Document rails new storage folder

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

Creating the Blog Applicationの項に、storageディレクトリについての説明を追加しています。


Reset CONTENT_LENGTH between test requests

actionpack/lib/action_controller/test_case.rbの修正です。

ActionController::TestRequestクラスでrequest毎にCONTENT_LENGTHをリセットするよう修正しています。

Reset RAW_POST_DATA between test requestsRAW_POST_DATAはリセットするようになっていたのですが、CONTENT_LENGTHはそのままになっていました。

ただ、CONTENT_LENGTHがそのままだと、そのCONTENT_LENGTHを信じて行われる処理で不整合がおきてしまう(実際のbodyのデータのサイズとあわない)為、CONTENT_LENGTHもリセットするよう修正しています。


Add quotes to code in rdoc comment in ActionController [ci skip]

actionpack/lib/action_controller/base.rbのdocの修正です。

ActionController::Baseのdoc内のexampleコードで、Stringを返すコードにダブルクォートを追加しています。


Merge pull request #32771 from yahonda/another_32720

Arelのテストの修正です。

Arel::Testの親クラスをActiveSupport::TestCaseに変更、及び、Arel::SpecActiveSupport::Testing::Assertionsをinclude及び必要なassertionメソッドを定義するようにし、Arelのテストでもrefute_xxではなくassert_not_xxxを使用するよう修正しています。