なるようになるブログ

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

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

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

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

activerecord/CHANGELOG.md

actioncable/CHANGELOG.md


Reduce FILENAME_MAX_SIZE to accomodate large PIDs

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

cache storeのファイル名の最大値を228から226に修正しています。

元々PIDが最大5桁(65535)である事を想定した数字になっていたのですが、今のLinuxだとPIDが最大7桁(4194304)になる為、その分数字を調整しています。


Deprecate and replace #default_hash and #[]

activerecord/lib/active_record/database_configurations.rbactiverecord/lib/active_record/railties/databases.rakeの修正です。

database configurationsのdefault_hash[]メソッドがdeprecateになりました。今後はconfigs_forメソッドを使う必要があります。


Introduce ActionCable::Channel#stop_stream_from/for to unsubscribe specific streams (#37171)

actioncable/lib/action_cable/channel/streams.rbの修正です。

特定のstreamをunsubscribeするためのActionCable::Channel#stop_stream_from及び#stop_stream_forメソッドを追加しています。

stop_stream_fromはstreamingを、stop_stream_forはmodelを指定するようになっています。

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

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

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

activestorage/CHANGELOG.md


Only enqueue analysis jobs when blob is analyzable

Active Jobの修正です。

analyzerにnull-analyzerが指定されている場合、analyzer処理用のjobをエンキューしないよう修正しています。


Fix typo [ci skip]

activestorage/lib/active_storage/analyzer.rbのdocの修正です。

analysisanlysisにタイポしていたのを修正しています。


Mark working_with_javascript_in_rails as WIP

guides/source/documents.yamlの修正です。

rails guideのWorking with JavaScript in RailsをWIPにしています。

exampleコードの内容が古い(coffeescriptjQueryを使用するコードになっている)為。WIP) Update SJR with vanilla js instead jqueryで修正対応中

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の生成を減らすようリファクタリングしています。

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

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

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


prevent helper_method from calling to_hash

actionpack/lib/abstract_controller/helpers.rbの修正です。

helper_methodメソッドで定義したメソッドで、引数を**kwargsで受け取っていたのを、*argsで受け取るよう修正しています。

to_hashメソッドの呼び出しが行われるのを避ける為。キーワード引数の警告対策には、代わりにruby2_keywordsを使うよう対応しています。


fix typos

docやテスト名のタイポをまとめて修正しています。


Don't encourage using octals for dates and times

数字を指定するのにoctal literalを使用していた箇所があったのを、使用していないよう修正しています。octal literalだと08以上を指定した場合にエラーになってしまい、例として良くないだろう、という理由です。


Fix CI failures due to MySQL 8.0.19 no longer output integer display width unless ZEROFILL is also used

activerecord/test/cases/adapters/mysql2/mysql2_adapter_test.rbactiverecord/test/cases/migration/change_schema_test.rbの修正です。

MySQL 8.0.19で、(ZEROFILLの指定が無い場合)SHOW CREATEの出力から整数表示幅が削除された事によりエラーになってしまうテストがあったのを修正しています。

参考: The MySQL 8.0.19 Maintenance Release is Generally Available | MySQL Server Blog

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

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

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

activerecord/CHANGELOG.md


Add scale support to ActiveRecord::Validations::NumericalityValidator

activemodel/lib/active_model/validations/numericality.rbactiverecord/lib/active_record/validations/numericality.rbの修正です。

ActiveRecord::Validations::NumericalityValidatorにscaleのサポートを追加しています。


Fix warning on arg forwarding in integration tests actionpack/lib/action_dispatch/testing/integration.rbの修正です。

integration testsのdelegation処理でキーワード引数に関する警告が表示されないよう対応しています。


Merge pull request #38206 from tsuka/fix-38178

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

Redis::Distributed client + namespaceを指定 + URLを複数指定している場合に、ActiveSupport::Cache::RedisCacheStore#clearを実行するとNoMethodErrorが発生するバグがあったのを修正しています。


Fix CI error with minitest 5.14

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

minitest 5.14で変更になったUnexpectedError#exceptionを使用している箇所がまだあったのを修正しています。


Fix random CI failure due to non-deterministic sorting order

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

assertionで値を比較する際に、値をidでsortしてからチェックするよう修正しています。 sortを指定しないと結果が不定になる為。


Pass Benchmark.ms block through to realtime

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

Benchmark.msメソッドの引数でblockを明示的に受け取るよう修正しています。余計なstackが追加されるのを避ける為。


rexml has been bundled gems in Ruby 2.8 (3.0)

Gemfileの修正です。

Gemfilerexml gemを追加しています。次のRubyからrexmlはbundled gemになる為。


Remove an empty line from generated migration

activerecord/lib/rails/generators/active_record/migration/templates/migration.rb.ttの修正です。

カラムを削除するmigrationファイルをgeneratorで生成した際に、remove_columnメソッドの前に不要な空行が含まれていたのを削除しています。


Fix typo and make indent/examples consistent on docs for where.missing

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

missingメソッドのdocのタイポの修正、フォーマットの修正等を行っています。


Fix my own typo now, ops! [ci skip]

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

先のdoc修正で違うタイポが含まれてしまったのを修正しています。