なるようになるブログ

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

rails commit log流し読み(2019/08/02)

2019/08/02分のコミットです。

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

activemodel/CHANGELOG.md


No private def

privateメソッドを定義するのに、

private def _back_url

という書き方(メソッド定義の前にprivateを使用する)をしていたのを、

def _back_url
  # ...
end
private :_back_url

に修正しています。既存のRailsのコードではprivate def xxという書き方をしておらず、一貫性の為に、との事です。

参考: These methods doesn't have to be protected


Fix _write_layout_method

actionview/lib/action_view/layouts.rbの修正です

_write_layout_methodメソッドのprivate指定の箇所に誤りがあったのを修正しています。


Add tests for selecting aggregates

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

AVGのような集計関数を使用した場合に、その結果がvirtual attributeとして参照出来る + 正しいcolumn typeになっている事を確認するテストを追加しています。


Deduplicate joins values

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

Preserve user supplied joins order as much as possibleでjoinの順序によって正しくjoinの重複排除が出来ないバグがあったのを修正しています。


MethodCallAssertions is a regular player of the team ActiveSupport::TestCase now

ActiveSupport::TestCaseのクラス定義時にActiveSupport::Testing::MethodCallAssertionsをincludeするよう修正し、各ファイルで個別にincludeせずに使用出来るよう修正しています。

が、mock用の処理をアプリケーションに公開したくない、との事で後ほどRevertされています。


You give jruby_skip & rubinius_skip a good name

コンポーネントのテストで独自に定義していたrubinius_skipjruby_skipメソッドを実装したmodule(ActiveSupport::Testing::AlternativeRuntimeSkipper)を追加 + ActiveSupport::TestCaseでincludeするようにして、各コンポーネントのテストからでrubinius_skipjruby_skipメソッドを削除しています。

が、jruby_skiprubinius_skipメソッドをアプリケーションに公開したくない、との事で後ほどRevertされています。


require only what each test concerns

Active Supportのテストでactive_support/core_ext/objectをrequireしていたのを、必要な機能のファイルのみをrequireするよう修正しています。


Missing require AS/core_ext/object/blank

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

不足していたactive_support/core_ext/object/blankのrequireを追加しています。


Let's try not to depend too much on other core extensions in a core extension test

activesupport/test/core_ext/object/json_gem_encoding_test.rbの修正です。

動的にテストを定義する際にString#underscoreを使用していたのを、使用しないよう修正しています。core extensionのテストでcore extensionの機能に依存するのを避ける為。


Missing require AS/core_ext/string/inflections

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

不足していたactive_support/core_ext/string/inflectionsのrequireを追加しています。


No such class since 8d2866bb80fbe81acb04f5b0c44f152f571fb29f

You give jruby_skip & rubinius_skip a good nameで削除したActiveModel::TestCaseを使用している箇所をActiveSupport::TestCaseを使用するよう修正しています。


Lazily evaluate FileUpdateCheckerSharedTests when being included

FileUpdateCheckerSharedTests moduleの各処理を、include時に定義するよう修正しています。


Remove duplicate method definition

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

Rails::Generatorsからno_color!メソッドを削除しています。Rails::GeneratorsがincludeしているRails::Command::Behaviorでまったく同じ内容のメソッドが定義されている為。


Add *_previously_was attribute methods when dirty tracking (#36836)

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

dirty tackingに変更前の値を取得する_previously_wasメソッドを追加しています。

pirate.update(catchphrase: "Ahoy!")
pirate.previous_changes["catchphrase"] # => ["Thar She Blows!", "Ahoy!"]
pirate.catchphrase_previously_was # => "Thar She Blows!"

hash_conversion itself does not at all depend on time extensions

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

不要なrequireを削除しています。


Missing require AS/core_ext/date/conversions

activesupport/test/core_ext/hash_ext_test.rbactivesupport/test/xml_mini_test.rbの修正です。

不足していたactive_support/core_ext/date/conversionsのrequireを追加しています。


Revert "You give jruby_skip & rubinius_skip a good name"

rubinius_skipjruby_skipメソッドを実装したmodule(ActiveSupport::Testing::AlternativeRuntimeSkipper)を追加した、You give jruby_skip & rubinius_skip a good nameをRevertいしています。理由は先に記載した通り。


Revert "MethodCallAssertions is a regular player of the team ActiveSupport::TestCase now"

ActiveSupport::TestCaseのクラス定義時にActiveSupport::Testing::MethodCallAssertionsをincludeするよう修正した、MethodCallAssertions is a regular player of the team ActiveSupport::TestCase nowをRevertしています。理由は先に記載した通り。


Revert "No such class since 8d2866bb80fbe81acb04f5b0c44f152f571fb29f"

ActiveModel::TestCaseを使用している箇所をActiveSupport::TestCaseを使用するよう修正した、No such class since 8d2866bb80fbe81acb04f5b0c44f152f571fb29fをRevertしています。 Revert "You give jruby_skip & rubinius_skip a good name"に伴いActiveModel::TestCaseが復活した為。


Require integer conversion for this test

actionview/test/template/date_helper_test.rbの修正です。

不足していたactive_support/core_ext/integer/timeのrequireを追加しています。


Require time extensions in the job that depends on time

activejob/test/jobs/timezone_dependent_job.rbの修正です。

不足していたactive_support/timeのrequireを追加しています。


ConditionalGet needs time core_ext

actionpack/lib/action_controller/metal/conditional_get.rbの修正です。

不足していたactive_support/core_ext/integer/timeのrequireを追加しています。


This test needs integer core ext for time

actionview/test/template/date_helper_i18n_test.rbの修正です。

不足していたactive_support/core_ext/integer/timeのrequireを追加しています。


Merge pull request #36814 from eileencodes/introduce-invalid-configuration-error

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

database configurationsの内容が誤っている場合に使用する為のActiveRecord::DatabaseConfigurations::InvalidConfigurationErrorを追加しています。