2017/07/16分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
- Skip unused components when running
bin/rails app:update
. - Allow to pass a connection to the
dbconsole
command - Passing the environment’s name as a regular argument to the
rails dbconsole
andrails console
commands is deprecated. - Properly expand shortcuts for environment’s name running the
console
anddbconsole
commands.
rails guideのA Guide to Testing Rails Applications
の修正です。
各項のグラマーの修正を行っています。
Merge pull request #29770 from y-yagi/fix_boolean_column_migration_script
Active Recordの修正です。
SQLite 3 adapterでbooleanの値を保持するのにStringのt
/ f
を使用していたのを、Integer(1
/ 0
)を使用するよう移行する為のスクリプトにタイポがあったのを修正しています。
Merge pull request #29769 from kamipo/remove_extra_order_for_first
Active Recordのテストの修正です。
テストでレコードの最初の行を取得するのに、all.merge!(order: "id").first
とorder
していたのを、単純にfirst
を使用するよう修正しています。
Made `first` finder consistent among database engines by adding a default order clause からRelation#first
はprimary keyでorderした値を返すようになっており、明示的にorder
する必要は無い為。
Merge pull request #29679 from kamipo/add_test_case_for_27724
activerecord/test/cases/associations/has_many_through_associations_test.rb
の修正です。
associationに既に存在しているconditionを上書き出来る事を確認するテストを追加しています。
railties/lib/rails/generators/rails/app/templates/bin/setup.tt
の修正です。
bin/setup
のbin/yarn
を実行する処理の後に不要な空行があったのを削除しています。
Do not generate unused components contents in app:update
task
railtiesの修正です。
app:update
taskで、使用していないコンポーネントに関するファイル、configは生成しないよう修正しています。
元々はアプリの状態に関わらず全てのファイル、configを生成するようになっていたのですが、例えば--skip-action-cable
を指定して作成したアプリの場合、Action Cablenに関するファイル、configは生成しないようになります。
Merge pull request #29771 from kamipo/fix_create_with_using_both_string_and_symbol
Active Recordの修正です。
create_with
に同じkeyをString、Symbolでそれぞれで指定した場合に、後から設定した値が正しく反映されないバグがあったのを修正しています。
Merge pull request #29809 from kamipo/remove_unused_ivars
activerecord/lib/active_record/relation.rb
の修正です。
ActiveRecord::Relation#reset
メソッドから使用していない変数を削除しています。
activerecord/lib/active_record/attribute_methods.rb
、
activerecord/lib/active_record/core.rb
の修正です。
使用していないファイルのrequire
を削除しています。
Set represent_boolean_as_integer
via configuration
Active Recordの修正です。
SQLite 3 adapterでbooleanの値を保持するのに、String又はIntegerを使用するかを指定する為のフラグをconfig経由で指定出来るよう修正しています。
元々はActiveRecord::ConnectionAdapters::SQLite3Adapter
のattributeを直接参照するようになっていたのですが、ActiveRecord::ConnectionAdapters::SQLite3Adapter
はinitiaiizer実行時点ではloadされておらず、initiaiizerから値が設定出来ない為、config経由で値を指定出来るようにしています。
add helper method for explicit lazy load
railties/test/application/configuration_test.rb
の修正です。
lazy load hookを呼び出す為のヘルパーメソッドを追加しています。
Fix create_with
with multiparameter attributes
activerecord/lib/active_record/scoping.rb
の修正です。
create_with
メソッドにmultiparameter attributes(date
型のwritten_on(1i)
、written_on(2i)
等)を指定出来るよう修正しています。
Active Recordの修正です。
scope_for_create
の結果をcacheしていたのを、cacheしないよう修正しています。通常の処理でcacheされたscope_for_create
が使われる事は無く、cacheする意味が無いため。
Allow to pass a connection to the dbconsole
command
railties/lib/rails/commands/dbconsole/dbconsole_command.rb
の修正です。
dbconsole
コマンドでconnection name(DB configファイルの3階層目の値)を指定出来るよう修正しています。
bin/rails dbconsole -c replica
のように、-c
オプション経由で指定出来るようになっています。
Deprecate environment as an argument for dbconsole and console
railties/lib/rails/command/environment_argument.rb
の修正です。
dbconsole
とconsole
コマンドのregular argumentとしてenvironment’s nameを指定するのがdeprecateになりました。今後はenvironment’s nameを指定するのに必ず-e
オプションを指定する必要があります。
# before $ bin/rails dbconsole production # after $ bin/rails dbconsole -e production
Properly expand the environment’s name
railtiesの修正です。
dbconsole
とconsole
コマンドの-e
オプションでenvironment’s nameを指定する際に、自動で補完(prod
と指定した場合、production
にしてくれる)するよう修正しています。
Replace Erubis with Erubi in a part of guide [ci skip]
rails guideのThe Rails Initialization Process
の修正です。
Railsが依存しているgemの一覧にerubis
が残っていたのを、erubi
に修正しています。