なるようになるブログ

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

rails commit log流し読み(2016/10/28)

2016/10/28分のコミットです。

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


Fixes an issue where time_zone_conversion that causes an exception in ARs delegation

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

ActiveRecord::AttributeMethods::TimeZoneConversion.inheritedメソッドで、メソッドの最後にsuperで親クラスのメソッドを呼び出していたのを、メソッドの最初に呼び出すよう修正しています。

          def inherited(subclass)
+            super
             # We need to apply this decorator here, rather than on module inclusion. The closure
             # created by the matcher would otherwise evaluate for `ActiveRecord::Base`, not the
             # sub class being decorated. As such, changes to `time_zone_aware_attributes`, or
@@ -80,7 +81,6 @@ def inherited(subclass)
                 TimeZoneConverter.new(type)
               end
             end
-            super
           end

最初に呼んでおかないと、abstract modelでinheritedメソッドを定義した際に、NoMethodErrorが発生してしまう問題があった為修正したとの事です。schemaが正しく取得出来てないから、とかですかねえ。


Permit loads while queries are running

Active Recordの修正です。

DBに対するqueryの実行中に、load処理が実行出来るよう修正しています。

一部抜粋。

-        log(sql, name) { @connection.query(sql) }
+        log(sql, name) do
+          ActiveSupport::Dependencies.interlock.permit_concurrent_loads do
+            @connection.query(sql)
+          end
+        end

queryの実行時にはDBでのlockが発生する為、load処理を実行出来るようにしておかないと、スレッド間でdeadlockが発生する可能性がある為、のようです。


Merge pull request #23770 from meinac/fix_habtm_symbol_class_name

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

has_and_belongs_to_manyメソッドのclass_nameオプションにClass、Symbolの値を指定した場合に正しく動作しないバグがあったのを修正しています。

内部的にはStringを指定する必要があった為、値を使用する際にStringに変換してから使用するよう修正しています。


Fix :stopdoc: to :startdoc: [ci skip]

actionpack/lib/action_dispatch/journey/formatter.rbのdocの修正です。

:startdoc:を指定すべき箇所に、:stopdoc:を指定してまっていたのを修正しています。


Explicitly show --no-helper and --no-assets options in help message

railties/lib/rails/generators/rails/controller/controller_generator.rbの修正です。

Rails::Generators::ControllerGeneratorクラスのclass_optionhelperassetsを追加しています。

controllerのhelpメッセージに上記オプションに関する情報が出るようにする為、との事です。


Add documentation for config.assets.version [skip ci]

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

config.assets.version optionについての説明を追加しています。


[ci skip] Revise TagHelper only permitting symbols doc.

actionview/lib/action_view/helpers/tag_helper.rbのdocの修正です。

ActionView::Helpers::TagHelper#tagメソッドのdoc内の、optionsのattribute namesにはSymbolしか使用出来ない旨説明している箇所の言い回しを修正しています。


Merge pull request #26688 from kamipo/remove_respond_to_indexes

activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rbactiverecord/test/cases/adapter_test.rbの修正です。

connection adapterにindexesメソッドが定義されているかどうかチェックしている処理を削除しています。全てのconnection adapterでindexesメソッドは実装されており、チェックする必要は無い為。