なるようになるブログ

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

rails commit log流し読み(2017/09/27)

2017/09/27分のコミットです。

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

activerecord/CHANGELOG.md

activesupport/CHANGELOG.md


Merge pull request #30550 from tgxworld/fix_memoization_preload

Active Recordの修正です。

性能改善の対応として、primary_keyメソッドの呼び出し回数の軽減、及び、owner_keysの生成処理を改善し、不要なmap / compact!メソッドを呼び出さないよう修正、等を行っています。


Treat Set as an Array in Relation#where

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

Relation#whereの引数にSetクラスの値を渡せるよう修正しています。Setが渡された場合、Arrayが渡された場合と同じ挙動になります。


Merge pull request #30713 from yhirano55/add_a_space_to_refinery_cms

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

RefineryCMSRefinery CMSに修正しています。


Change :github git source for bug report templates

bug report templatesの修正です。

githubショートハンドを使用した場合、httpsを使用するよう修正しています。warningが表示されるのを避ける為。githubショートハンドを使用していないファイルには不要そうな気も。


Don't generate foreign_type if options[:polymorphic] is not given

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

Reflection::AssociationReflection#initializeメソッドでoptions[:polymorphic]が指定されている場合のみforeign_typeを生成するよう修正しています。

reflectionはassociationがpolymorphic associationのときのみforeign_typeを保持している為。


Remove unused cached_columns and time_related_columns_on_topic in AttributeMethodsTest

activerecord/test/cases/attribute_methods_test.rbの修正です。

使用していないAttributeMethodsTest#cached_columns#time_related_columns_on_topicメソッドを削除しています。


Remove unused code that was copied from actionpack

actionview/test/abstract_unit.rbの修正です。

使用していないRails.envメソッドの定義や、StubDispatcherクラス等を削除しています。


Include ActionDispatch::DrawOnce in ActiveSupport::TestCase

actionview/test/abstract_unit.rbの修正です。

先のコミットでActionDispatch::DrawOnceのinclude先をActiveSupport::TestCaseからActionController::TestCaseクラスに移動したいのですが、それだとエラーになるテストがある(ActiveSupport::TestCaseを親クラスにしているテストがある)為、ActiveSupport::TestCaseでincludeするよう戻しています。


Postgres::OID::Range serializes to a Range, quote in Quoting

activerecord/lib/active_record/connection_adapters/postgresql/oid/range.rbactiverecord/lib/active_record/connection_adapters/postgresql/quoting.rbの修正です。

PostgreSQLのtsrange型を使用した場合に、subsecond precisionの値を保持するよう修正しています。

元々PostgreSQLとしてはsubsecondは保持できるようになっていたのですが、Rails側で正しく値を扱えてなかったのを修正しています。


Add test case for arel_attribute with a custom table

activerecord/test/cases/relations_test.rbactiverecord/test/models/post.rbの修正です。

custom table + arel_attributeメソッドを使用した場合のテストを追加しています。


Ensure HashWithIndifferentAccess#transform_keys to return HashWithIndifferentAccess

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

HashWithIndifferentAccess#transform_keysメソッドがHashインスタンスを返していたのを、HashWithIndifferentAccessインスタンスを返すよう修正しています。

HashWithIndifferentAccess#transform_valuesや、#selectメソッドはHashWithIndifferentAccessインスタンスを返すようになっており、挙動を合わせる為。


Add newlines before/after the git_source in bug report templates

bug report templatesの修正です。

git_sourceの指定の前後に空行を入れるよう修正しています。


Merge pull request #30614 from kami-zh/yarn-on-bin-update

railties/lib/rails/generators/rails/app/templates/bin/update.ttの修正です。

bin/updateのテンプレートファイルにbin/yarnを実行する処理を追加しています。

<% unless options.skip_yarn? -%>

  # Install JavaScript dependencies if using Yarn
  # system('bin/yarn')
<% end -%>

デフォルトではbin/setupのテンプレートと同じく、コメントアウトされた状態です。