なるようになるブログ

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

rails commit log流し読み(2015/08/24)

2015/08/24分のコミットです。

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

activerecord/CHANGELOG.md


remove usage of @env

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

envの値を取得/設定する際、env hashを直接操作するのではなく、getter /setter メソッド経由で値を操作するよう修正しています。


convert more @env access to get / set header

actionpack/lib/action_controller/test_case.rbactionpack/lib/action_dispatch/middleware/cookies.rbの修正です。

引き続き、envの値を取得/設定する際、env hashを直接操作するのではなく、getter /setter メソッド経由で値を操作するよう修正しています。


remove more env access

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

引き続き、envの値を取得/設定する際、env hashを直接操作するのではなく、getter /setter メソッド経由で値を操作するよう修正しています。


remove more env access

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

引き続き、envの値を取得/設定する際、env hashを直接操作するのではなく、getter /setter メソッド経由で値を操作するよう修正しています。


remove more env access

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

引き続き、envの値を取得/設定する際、env hashを直接操作するのではなく、getter /setter メソッド経由で値を操作するよう修正しています。


remove env access from debug_exceptions

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

引き続き、envの値を取得/設定する際、env hashを直接操作するのではなく、getter /setter メソッド経由で値を操作するよう修正、及び、 DebugExceptions#render_exceptionメソッドDebugExceptions#log_errorメソッドの引数をenv hashからrequest objectに修正しています。一度作成したrequest objectを使いまわせせるようにするため、との事。


use Request#path_info instead of direct ENV access

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

PublicExceptions#callメソッドでenvの値をする際、env hashを直接操作するのではなく、requestオブジェクト経由で値を取得するよう修正しています。


use methods on the request object instead of accessing env

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

ShowExceptions#render_exceptionメソッドの引数をenv hashからrequestオブジェクトに変更し、必要な値を取得する際、env hashから直接値を取得するのではなく、requestオブジェクト経由で値を取得するよう修正しています。


Removed Mocha from ActionView part 1

ActionViewのテストの修正です。

mock処理に、mochaではなく、rails内部のヘルパーメソッドを使用するよう修正しています。 part 1とコミットログにある通り、まだ作業中のようです。


Fix docs for debugging [ci skip]:

rails guideのDebugging Rails Applicationsの修正です。

  • threadのコマンドリストの、タイトル説明の間に区切りのコロンを追加
  • The Shellの項にタイポがあったのを修正
  • continuefinish コマンドについて説明している箇所のエスケープ箇所の調整

をまとめて行っています。


[ci skip] Fix the grammar

rails guideのAPI Documentation Guidelinesの修正です。

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


add commas removed earlier [ci skip]

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

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


Revert "[ci skip] Fix to a, b or c format"

rails guideのActive Support Core Extensionsの修正です。

Changing Componentsの項、カンマのフォーマットを、oxford comma形式に戻しています。


Remove unused variables

actionpack/test/controller/live_stream_test.rbの修正です。

test_abort_with_full_bufferから、使用していない変数を削除しています。


Only nullify persisted has_one target associations

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

has_one association + dependent nullifyを使用している場合に、データが保存済みのレコードについてのみnullifyを行うよう修正しています。

dependentの書き方によって、削除済みのレコードに対してnullifyをしようとしてしまいエラーになってしまう問題があった為修正しています。PRより。

class Car < ActiveRecord::Base
  has_one :engine, dependent: :nullify
end

class Engine < ActiveRecord::Base
  belongs_to :car, dependent: :destroy
end
car = Car.create!
engine = Engine.create!(car: car)
engine.destroy! # => ActiveRecord::ActiveRecordError: cannot update a destroyed record

最後のdestroy!処理で、engineをdestroy -> engineのdependentの設定で、carをdestroy -> carのdependentの設定で、engineをnullify -> エラー、となってしまっていました。中々に特殊なケースな感ありますが…。


guides, move incomplete example to corresponding option. #21349

rails guideのActive Record Query Interfaceの修正です。

Options for find_eachの項、begin_atオプションの箇所で説明しているexampleが、end_atオプションを使用するする前提のexampleになっていた為、exampleをend_atオプションの箇所に移動しています。


Get rid of mocha tests - part 1

ActionPackのテストの修正です。

mock処理に、mochaではなく、rails内部のヘルパーメソッドを使用するよう修正しています。 part 1とコミットログにある通り、こちらもまだ作業中のようです。


Merge pull request #21091 from y-yagi/add_activejob_section_to_instrumentation_guide

rails guideのActive Support Instrumentationの修正です。

Active Jobセクションを追加し、Active Jobのhooksについての説明を追加しています。


[ci skip] Fix migration file's timestamp

activerecord/lib/active_record/migration.rbguides/source/active_record_migrations.mdのdocの修正です。

migrationのrevertメソッドのexampleで、exampleに使用するmigrationファイルのフォーマットが、実際のフォーマットと(YYYYMMDDHHMMSSフォーマット)異なっていたのを、修正しています。


Fix failing tests caused by #21350

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

Only nullify persisted has_one target associationsの対応で追加したテストファイルで、requireが不足していたのを追加しています。


Further fix failing tests caused by #21350

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

先のコミットと同様、Only nullify persisted has_one target associationsの対応で追加したテストファイルで、requireが不足していたのを追加しています。