なるようになるブログ

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

rails commit log流し読み(2020/01/16)

2020/01/16分のコミットです。

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


Allow ActiveSupport deprecation warnings to be configured as disallowed

Active Supportの修正です。

deprecation messageが出力された場合の振る舞いを指定出来る対応しています。

対象とするmessage及び振る舞いはconfigで指定(config.active_support.disallowed_deprecation_warningsconfig.active_support.disallowed_deprecation)出来るようになっています。

例。

ActiveSupport::Deprecation.disallowed_behavior = :raise
ActiveSupport::Deprecation.disallowed_warnings = [
  "something broke"
]

ActiveSupport::Deprecation.warn('something broke!')
# => ActiveSupport::DeprecationException

Prefer match? over match

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

MatchDataが不要な箇所でmatchを使用していたのを、match?を使用するよう修正しています。


Avoid extra Array allocation

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

booleanの値だけ必要な箇所でArrayを使用していたのを、booleanを使用するよう修正しています。


If dependent: nil is valid for has_many, it also be valid for has_one

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

has_onedependentオプションに指定出来る値のリストにnilを追加しています。


Remove SQLite version support caveats [ci skip]

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

Nested transactionsについて説明している箇所からSQLite3のバージョンについての説明を削除しています。Rails 6.0でサポートしているSQLite3では全て使用出来る為。


Avoid extra Array allocation for build_tag_values

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

build_tag_valuesメソッドで値を組み立てる際にArrayの生成を減らすようリファクタリングしています。