なるようになるブログ

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

rails commit log流し読み(2015/03/19)

2015/03/19分のコミットです。

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

railties/CHANGELOG.md


Change commands in the Getting Started guide to use scripts in bin/

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

railsrakeコマンドをbin/railsbin/rakeに修正しています。


[ci skip] use false as value rather than symbol

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

has_manyメソッドのオプションについてのexampleのタイポ(:false -> false)を修正しています。


[skip ci] Fixed typo

rails guideのThe Asset Pipelineの修正です。

Set up a CDN to Serve Static Assetsの項の説明内にあったタイポ(a -> at)を修正しています。


Active Record changelog pass [skip ci]

activerecord/CHANGELOG.mdの修正です。

CHANGELOG全体のタイポ、グラマーの修正を行っています。


[ci skip] use true as value rather than symbol

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

:touchオプションについての説明内にあったタイポ(:true -> true)を修正しています。


don't fallback to RACK_ENV when RAILS_ENV is not present

ENV["RAILS_ENV"]が設定されていない場合に、ENV["RACK_ENV"]から値を取得しようとしていた処理を、全て削除しています。

-      @_env ||= ActiveSupport::StringInquirer.new(ENV["RAILS_ENV"] || ENV["RACK_ENV"] || "test")
+      @_env ||= ActiveSupport::StringInquirer.new(ENV["RAILS_ENV"] || "test")

元々はRAILS_ENVの代わりとしてRACK_ENVの値を使用出来たようなのですが、現状、取得出来る内容に互換性は無く、RACK_ENVから適切な値は取得出来ないとの事で、削除しています。 詳しくは、Brane Dump: RACK_ENV: It's not for you を参照で。


Merge pull request #19406 from larskanis/add_changelog_entry_for_17680

activerecord/CHANGELOG.mdの修正です。

pg gemの0.18.0を使用した際にArgumentErrorが発生するのを対応したコミット(PostgreSQL, Fix change detection caused by superfluous bytea unescaping)についてのエントリをCHANGELOGに追加しています。


Merge pull request #19387 from arthurnn/fix_route_regression

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

generatorがroutes.rbにrouteを追加する際、終端に改行を追加するよう修正しています。

-          inject_into_file 'config/routes.rb', "  #{routing_code}", { after: sentinel, verbose: false, force: true }
+          inject_into_file 'config/routes.rb', "  #{routing_code}\n", { after: sentinel, verbose: false, force: true }

Don't remove all line endings from routes.rb の対応で終端に改行を追加しないよう対応したのですが、改行が無いと、deviseのような3rd partyのlibraryのgeneratorが生成するrouteが上手く動作しない(一行に、railsが生成したrouteと、library側が生成したrouteが両方定義されてしまいエラーになる)ので、再度修正を行ったとの事です。


Merge pull request #19216 from senny/bin_test_runner

railties の修正です。テスト実行用のbin/rails testコマンドを追加しています。

$ ./bin/rails t --help
Usage: bin/rails test [options] [file or directory]

    -e, --environment [ENV]          run tests in the ENV environment

Filter options:

  You can run a single test by appending the line number to filename:

    bin/rails test test/models/user_test.rb:27

    -n, --name [NAME]                Only run tests matching NAME
    -p, --pattern [PATTERN]          Only run tests matching PATTERN

Output options:
    -b, --backtrace                  show the complte backtrace

Common options:
    -h, --help                       Show this message

特定のファイルだけではなく、特定の行数だけのテスト等も実施可能になっているようです。便利そう。


method_source needs to be a hard dependency on railties

railties/railties.gemspecの修正です。

add_dependencymethod_sourceを追加しています。上記で追加されたrails testコマンドでmethod_sourceを使用しているので、依存関係に追加しています。


Fix test rake when passing multiple arguments

railties/lib/rails/test_unit/testing.rakeの修正です。

rakeコマンドの引数に複数の値をしてした場合にRails::TestRunner.runメソッドがエラーになってしまっていたのを修正しています。


Use absolute path on find_method location for the runner

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

指定されたメソッドを定義されたファイル名を、絶対パスで保持するよう修正しています。


add foreign_key option to result of references column type [ci skip]

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

referencesカラムを指定した場合の実行結果のexampleに、foreign_key: trueオプションを追加しています。

Add a foreign_key option to references and add_reference.の対応により、referencesforeign_keyオプションが指定可能になり、generatorが生成する結果も変更になっているので、現状の修正内容と合うよう修正しています。


Updated MySQL documentation link for STRICT_ALL_TABLES

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

STRICT_ALL_TABLES についての参考URLをhttp://dev.mysql.com/doc/refman/5.0/en/server-sql-mode.html から http://dev.mysql.com/doc/refman/5.6/en/sql-mode.htmlに修正しています。