なるようになるブログ

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

rails commit log流し読み(2017/10/24)

2017/10/24分のコミットです。

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

actionview/CHANGELOG.md

actionpack/CHANGELOG.md

actioncable/CHANGELOG.md

activerecord/CHANGELOG.md

activesupport/CHANGELOG.md


Remove deprecated Erubis ERB handler

Action Viewの修正です。

deprecateになっていたErubis ERB handlerを削除しています。


Remove deprecated ActionController::ParamsParser::ParseError

actionpack/lib/action_dispatch/http/parameters.rbの修正です。

deprecateになっていたActionController::ParamsParser::ParamsParserクラスを削除しています。


Removed deprected evented redis adapter

Action Cableの修正です。

deprecateになっていたevented redis adapterのサポートを削除しています。


Remove deprecated support to quoted_id when typecasting an Active Record object

Active Recordの修正です。

deprecateになっていたquoted_idメソッドによるquote処理のサポートを削除しています。


Remove deprecated argument default from index_name_exists?

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

deprecateになっていたindex_name_exists?メソッドのdefault引数を削除しています。


Remove deprecated support to passing a class to :class_name on associations

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

deprecateになっていたassociationsの:class_nameオプションにClassを渡した場合のサポートを削除しています。


Rase when calling lock! in a dirty record

activerecord/lib/active_record/locking/pessimistic.rbの修正です。

dirty recordでlock!メソッドを呼び出し際に、エラーをraiseするよう修正しています。

参考:Deprecate locking of dirty records


Remove deprecated methods initialize_schema_migrations_table and initialize_internal_metadata_table

activerecord/lib/active_record/connection_adapters/abstract/schema_statements.rbの修正です。

deprecateになっていたinitialize_schema_migrations_tableメソッド、及び、initialize_internal_metadata_tableメソッドを削除しています。


Remove deprecated method supports_migrations?

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

deprecateになっていたsupports_migrations?メソッドを削除しています。


Remove deprecated method supports_primary_key?

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

deprecateになっていたsupports_primary_key?メソッドを削除しています。


Remove deprecated method ActiveRecord::Migrator.schema_migrations_table_name

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

deprecateになっていたActiveRecord::Migrator.schema_migrations_table_nameメソッドを削除しています。


Remove deprecated argument name from #indexes

Active Recordの修正です。

deprecateになっていたindexesメソッドのname引数を削除しています。


Remove deprecated arguments from #verify!

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

deprecateになっていたverify!メソッドの引数を削除しています。


Remove deprecated configuration .error_on_ignored_order_or_limit

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

deprecateになっていたActiveRecord::Base.error_on_ignored_orderを削除しています。


Remove deprecated methd #scope_chain

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

deprecateになっていたscope_chainメソッドを削除しています。


Remove deprecated method #sanitize_conditions

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

deprecateになっていたsanitize_conditionsメソッドを削除しています。


Change the deprecation horizon of the dynamic routes segment to 6.0

actionpack/lib/action_dispatch/routing/route_set.rbの修正です。

routesのpath parametersに:controller:actionを指定した場合のサポートの削除予定が5.2 -> 6.0に変更になりました。

恐らくアプリに与える影響が大きい為。この対応の削除の延期2回目。


Remove deprecated :if and :unless string filter for callbacks

Active Supportの修正です。

deprecateになっていたcallbackの:if:unlessオプションにStringを渡した場合のサポートを削除しています。今後はStringを渡した場合ArgumentErrorがraiseされます。


Remove deprecated halt_callback_chains_on_return_false option

activesupport/lib/active_support.rbの修正です。

deprecateになっていたActiveSupport.halt_callback_chains_on_return_falseオプションを削除しています。


Remove text about deprecation that was already removed

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

has_manyメソッドのdoc内、Accessing the owner objectについて説明している箇所に既に削除された挙動についての説明があったのを削除しています。


specify minimum capybara version for system tests

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

ファイルの先頭でcapybara gemがロード出来るかチェックするよう修正しています。

+gem "capybara", "~> 2.13"
+
require "capybara/dsl"

System Testを使うにはcapybara 2.13以上を使用する必要があるのですが、upgradeしたアプリケーションだと古いcapybaraを使用している可能性があり、その場合に適切なエラーメッセージを表示出来るようにする為に上記対応を行っています。


Remove mention about Evented Redis [ci skip]

rails guideのAction Cable Overviewの修正です。

Redis Adapterの項からEvented Redisに言及している箇所を削除しています。


Merge pull request #30920 from lugray/attributes_to_am

activemodel/lib/active_model/attributes.rbの修正です。

現状Active Record内にあるattributes APIをActive Modelに移動する予定があるらしく、そのファーストスッテプとして、ActiveModelAttributes moduleを作成しています。

また対応中なのでpublicになってはいませんが、対応が全部終わればActive Modelでもattributes APIを使えるようになりそう。


Performance improvements for acts_like? method.

activesupport/lib/active_support/core_ext/object/acts_like.rbの修正です。

acts_like?メソッドの性能改善対応を行っています。

  def acts_like?(duck)
-    respond_to? :"acts_like_#{duck}?"
+    case duck
+    when :time
+      respond_to? :acts_like_time?
+    when :date
+      respond_to? :acts_like_date?
+    when :string
+      respond_to? :acts_like_string?
+    else
+      respond_to? :"acts_like_#{duck}?"
+    end
   end

引数が:time / :date / :stringの場合、Stringオブジェクトの生成処理が無くなる("acts_like_#{duck}?"が無い為)ので、左記のオブジェクトの場合~2.7x程度高速するとの事です。詳細なベンチマークコミットログ参照。


Remove supports_disable_referential_integrity?

activerecord/lib/active_record/connection_adapters/postgresql/referential_integrity.rbの修正です。

PostgreSQL::ReferentialIntegrity#supports_disable_referential_integrity?メッセージを削除しています。

supports_disable_referential_integrity?メッセージはALTER TABLE <table name> DISABLE/ENABLE TRIGGER がサポートされているかどうかチェックする為のメソッドなのですが、DISABLE/ENABLE TRIGGERはPostgreSQL 8.1から使用出来る、かつ、今のRailsがサポートしているPostgreSQLは9.1以上であり、もうチェックする必要は無い為削除しています。


Space between { and | missing.

railties/lib/rails/generators/rails/plugin/plugin_generator.rbの修正です。

generate_test_dummyメソッドでRubocopの規約に違反しているコードがあったのを修正しています。


Ensure associations doesn't table name collide with aliased joins

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

Associations::AliasTracker.initial_count_forメソッドでtable名を参照するのにjoin.left.table_nameを使用していたのを、join.left.nameを使用するよう修正しています。

table_nameだとalias名が使用されない為、aliasの衝突が正しく検知出来るよう上記修正を行ったようです。


add _ for unused last arg

railties/lib/rails/generators/rails/plugin/plugin_generator.rbの修正です。

blockで使用していない変数の変数名に_を使用するよう修正しています。


Make clear that Time core extensions are split between Numeric and Integer

activesupport/lib/active_support/core_ext/numeric/time.rbのdoc、及び、rails guideのActive Support Core Extensionsの修正です。

core_ext/numeric/time.rbについてのdocでyearsmonthsメソッド等別のファイル(core_ext/integer/time.rb)に定義されているメソッドをを使用していたのを、weeksdaysメソッド等numeric/time.rbに定義されているメソッドを使用するよう修正しています。