2017/01/31分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
Simplify Postgres query for column_definitions()
activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb
の修正です。
column_definitions
メソッドでカラムの情報を取得するSQLにサブクエリーを使用していたのを、JOIN句を使用するよう修正しています。高速化の為。
PRより。
Before:
jordan=# explain SELECT a.attname, format_type(a.atttypid, a.atttypmod), pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod, (SELECT c.collname FROM pg_collation c, pg_type t WHERE c.oid = a.attcollation AND t.oid = a.atttypid AND a.attcollation <> t.typcollation), col_description(a.attrelid, a.attnum) AS comment FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum WHERE a.attrelid = 'a'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum; QUERY PLAN -------------------------------------------------------------------------------------------------------------- Nested Loop Left Join (cost=4.46..74.93 rows=3 width=119) Join Filter: ((a.attrelid = d.adrelid) AND (a.attnum = d.adnum)) -> Index Scan using pg_attribute_relid_attnum_index on pg_attribute a (cost=0.28..12.26 rows=3 width=83) Index Cond: ((attrelid = '3525321'::oid) AND (attnum > 0)) Filter: (NOT attisdropped) -> Materialize (cost=4.18..12.66 rows=4 width=38) -> Bitmap Heap Scan on pg_attrdef d (cost=4.18..12.64 rows=4 width=38) Recheck Cond: (adrelid = '3525321'::oid) -> Bitmap Index Scan on pg_attrdef_adrelid_adnum_index (cost=0.00..4.18 rows=4 width=0) Index Cond: (adrelid = '3525321'::oid) SubPlan 1 -> Nested Loop (cost=0.29..16.34 rows=1 width=64) -> Index Scan using pg_collation_oid_index on pg_collation c (cost=0.15..8.17 rows=1 width=64) Index Cond: (oid = a.attcollation) -> Index Scan using pg_type_oid_index on pg_type t (cost=0.15..8.17 rows=1 width=0) Index Cond: (oid = a.atttypid) Filter: (a.attcollation <> typcollation) (17 rows)
After:
jordan=# explain SELECT a.attname, format_type(a.atttypid, a.atttypmod), pg_get_expr(d.adbin, d.adrelid), a.attnotnull, a.atttypid, a.atttypmod, c.collname, col_description(a.attrelid, a.attnum) AS comment FROM pg_attribute a LEFT JOIN pg_attrdef d ON a.attrelid = d.adrelid AND a.attnum = d.adnum LEFT JOIN pg_collation c ON c.oid = a.attcollation LEFT JOIN pg_type t ON t.oid = a.atttypid AND a.attcollation <> t.typcollation WHERE a.attrelid = 'collation_test'::regclass AND a.attnum > 0 AND NOT a.attisdropped ORDER BY a.attnum; QUERY PLAN -------------------------------------------------------------------------------------------------------------------------------- Merge Left Join (cost=38.41..39.23 rows=3 width=179) Merge Cond: (a.attnum = d.adnum) Join Filter: (a.attrelid = d.adrelid) -> Sort (cost=25.73..25.73 rows=3 width=143) Sort Key: a.attnum -> Hash Right Join (cost=12.30..25.70 rows=3 width=143) Hash Cond: (c.oid = a.attcollation) -> Seq Scan on pg_collation c (cost=0.00..11.69 rows=269 width=68) -> Hash (cost=12.26..12.26 rows=3 width=83) -> Index Scan using pg_attribute_relid_attnum_index on pg_attribute a (cost=0.28..12.26 rows=3 width=83) Index Cond: ((attrelid = '3525342'::oid) AND (attnum > 0)) Filter: (NOT attisdropped) -> Sort (cost=12.68..12.69 rows=4 width=38) Sort Key: d.adnum -> Bitmap Heap Scan on pg_attrdef d (cost=4.18..12.64 rows=4 width=38) Recheck Cond: (adrelid = '3525342'::oid) -> Bitmap Index Scan on pg_attrdef_adrelid_adnum_index (cost=0.00..4.18 rows=4 width=0) Index Cond: (adrelid = '3525342'::oid) (18 rows)
Docs: Specify return value of save!
activerecord/lib/active_record/persistence.rb
のdocの修正です。
save!
メソッドのdocに、エラーがおきなければtrue
を返すむね説明を追加しています。
Merge pull request #27787 from y-yagi/show_correct_class_name_in_migration_error
activerecord/lib/active_record/migration.rb
の修正です。
migration ファイルでActiveRecord::Migration
を直接継承した場合(バージョン情報を設定しなかった場合)に出力されるエラーメッセージに表示されるクラス名に誤りがあったのを修正しています。
Merge pull request #27784 from y-yagi/add_warnings_option_to_test_runner
railties/lib/rails/test_unit/minitest_plugin.rb
の修正です。
test runnerにRubyのwarningを有効化する為のオプション(-w
, --warnings
)を追加しています。
Make internal classes internal for the documentation
actionmailer/lib/action_mailer/parameterized.rb
のdocの修正です。
ActionMailer::Parameterized
module配下の内部用のクラスに:nodoc:
を設定しています。
Override the initializers instead of using tap
actionmailer/lib/action_mailer/parameterized.rb
の修正です。
ActionMailer::Parameterized::MessageDelivery#initialize
メソッドを追加して、必要なパラメータの設定をそこで行うよう修正しています。
actionmailer/lib/action_mailer/parameterized.rb
のdocの修正です。
ActionMailer::Parameterized::DeliveryJob#perform
メソッドの:nodoc:
を削除しています。DeliveryJob
クラス自体に:nodoc:
が設定されており、メソッドに:nodoc:
を設定する必要は無いため。
Implement respond_to_missing? in the Parameterized::Mailer class
actionmailer/lib/action_mailer/parameterized.rb
の修正です。
ActionMailer::Parameterized::Mailer
クラスにrespond_to_missing?
メソッドを追加しています。ActionMailer::Parameterized::Mailer
クラスにはmethod_missing
メソッドが定義されている為。
actionmailer/test/parameterized_test.rb
の修正です。
テスト名にshould
が使われていたのを削除しています。
- test "should enqueue the email with params" do + test "enqueue the email with params" do
コミットログの通りで、テスト名にはshould
を避けるべきだから、という理由の為。
No need to advertise in the rdoc documentation
actionmailer/lib/action_mailer/parameterized.rb
のdocの修正です。
ActionMailer::Parameterized
moduleのdocにActionMailer::Parameterized
についての広告(That's a big improvement!…
という文)が入っていたのを削除しています。
actionmailer/lib/action_mailer/parameterized.rb
のdocの修正です。
ActionMailer::Parameterized
moduleのdoc内のexampleコードから不要なスペースを削除しています。
Document with with an example an link to Parameterized
actionmailer/lib/action_mailer/parameterized.rb
の修正です。
ActionMailer::Parameterized.with
メソッドにdocを追加、及びActionMailer::Parameterized
moduleのdocへのリンクを追加しています。
Merge pull request #27822 from mtsmfm/bump-unicode-version
Active Supportの修正です。
Active Supportで保持しているunicode tableのデータを、8.0.0から9.0.0に更新しています。
合わせて、ActiveSupport::Multibyte::Unicode.unpack_graphemes
メソッドの処理を、Unicode 9.0.0のUNICODE TEXT SEGMENTATIONの仕様に合わせて更新しています。
Merge pull request #27851 from tenderlove/scope-chain
Active Recordの修正です。
scopeを取得するのにscope chainを保持する為の配列を作成し使用していたのを、各reflctionクラスにscopes
メソッドを追加し、reflctionからscopeを取得出来るよう修正しています。
Added warning for reserved YAML keywords.
railties/lib/rails/generators/rails/app/templates/config/locales/en.yml
、
Rais GuideのRails Internationalization (I18n) API
の修正です。
デフォルトで生成されるen.yml
、及びRail GuideにYAMLのキーワードはそのまま使えず、エスケープが必要である旨説明を追加しています。具体的には、true, on, yes, false, off, no
。
Avoid lambda scopes when possible
activerecord/lib/active_record/reflection.rb
の修正です。
ThroughReflection#source_type_scope
メソッドでsource_type
scopeを取得するのに、lambda scopesを使用していたのを、through_reflection
経由で取得するよう修正しています。
def source_type_scope - type = foreign_type - source_type = options[:source_type] - lambda { |object| where(type => source_type) } + through_reflection.klass.where(foreign_type => options[:source_type]) end
この時点でreflection経由で正しいscopeを取得出来る為そちらを使用するようにしたようです。多分。コミットメッセージにあったLambda scopes require a bunch more work
の意味がよくわからない…。
Merge pull request #27797 from y-yagi/correctly_check_error_message
各テストで、assert_raise
の第二引数にエラーメッセージを指定している箇所があったのですが、assert_raise
はエラーメッセージのチェックは行わずメッセージについてのテストが正しく出来てなかったので、別途assertionを追加し、メッセージについてはそちらで確認するよう修正しています。
add default value to deliver_later_queue_name
option [ci skip]
actionmailer/lib/action_mailer/base.rb
のdocの修正です。
ActionMailer::Base
クラスのdoc内のdeliver_later_queue_name
オプションにデフォルト値についての説明を追加しています。
Merge pull request #27647 from Shopify/fully-eagerload-journey
Action Pack / railtiesの修正です。
最初のrequestの際にroutesの初期化処理を行っていたのを、server boot時にroutesの初期化処理を行うよう修正しています(config.eager_loadがtrueの場合のみ)。最初のresponseが遅くなるのを避けれるようにする為。
Merge pull request #27738 from kenta-s/remove-unused-argument-formats
actionview/lib/action_view/template/resolver.rb
、
actionview/lib/action_view/testing/resolvers.rb
の修正です。
ActionView::PathResolver#extract_handler_and_format_and_variant
メソッドから使用していないdefault_formats
引数を削除しています。
Merge pull request #27849 from joevandyk/patch-2
activerecord/lib/active_record.rb
の修正です。
LegacyYamlAdapter
moduleの読み込みをeager_autoload
ブロック内で行うよう修正しています。
ActiveRecord::Core#init_with
でLegacyYamlAdapter
を使用しているのですが、時折LegacyYamlAdapter
moduleが存在しないエラーが発生してしまう為、確実に読み込み処理が行われるよ移動したようです。
Don’t mutate raw_source in mailer preview interceptor
actionmailer/lib/action_mailer/inline_preview_interceptor.rb
の修正です。
mailer previewで画像の表示を行う際に、Mail::Body#raw_source
メソッドの結果の値を変化させていたのを、変化させないよう修正しています。
raw_source
はbodyの作成使用された際の値を返すようになっており、その値を変化させると、本来想定している値と違う値がraw_source
かえされる事になってしまう為、それを避ける為修正したとの事です。
Merge pull request #27824 from kenta-s/raise-an-error-if-no-block-given
activesupport/lib/active_support/evented_file_update_checker.rb
、
activesupport/lib/active_support/file_update_checker.rb
の修正です。
EventedFileUpdateChecker#execute
、FileUpdateChecker#execute
メソッドで処理を実行する際に、@block
がnilの場合にArgumentError
をraiseするよう修正しています。
@block
はクラスの初期化時点で渡すので、後ほどinitialize
でblockが渡されるかどうかチェックするよう修正されています。
Raise in the initialize not in the execute
activesupport/lib/active_support/evented_file_update_checker.rb
、
activesupport/lib/active_support/file_update_checker.rb
の修正です。
EventedFileUpdateChecker#initialize
、FileUpdateChecker#initialize
の引数にblockが渡されていない場合に、ArgumentError
をraiseするよう修正しています。
Merge pull request #27838 from kamipo/reload_destroyed_through_record
activerecord/lib/active_record/associations/has_one_through_association.rb
の修正です。
Associations::HasOneThroughAssociation#create_through_record
メソッドでthrough_record
がdestroy済みの場合に、through_record
の値をreloadするよう修正しています。
reloadせずに値を追加しようとすると、エラーに(RuntimeError: Can't modify frozen hash
)なってしまう為、reloadするよう修正したとの事です。
Remove redundant right parentheses in number_helper [ci skip]
activesupport/lib/active_support/number_helper.rb
のdocの修正。
number_to_phone
メソッドのexampleコードに閉じカッコが多かったのを削除しています。
Add test for variable_size_secure_compare
activesupport/test/security_utils_test.rb
の修正です。
ActiveSupport::SecurityUtils.variable_size_secure_compare
メソッドのテストを追加しています。
Merge pull request #27855 from kevinzwhuang/finder-methods-typo-fix
activerecord/lib/active_record/relation/finder_methods.rb
のdocの修正です。
find
メソッドのdoc内のグラマーの修正を行っています。