なるようになるブログ

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

rails commit log流し読み(2020/10/30)

2020/10/30分のコミットです。

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

activerecord/CHANGELOG.md

actionpack/CHANGELOG.md

actionview/CHANGELOG.md

activejob/CHANGELOG.md

activestorage/CHANGELOG.md

activesupport/CHANGELOG.md

railties/CHANGELOG.md


Improve use_sha1_digests deprecation message

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

deprecatedになったconfig.active_support.use_sha1_digestsを使用している場合のdeprecateメッセージに、config.active_support.hash_digest_class経由で`digestにSHA1を使う方法についての説明を含むよう修正しています。


Add documentation for granular connection switching

rails guideのMultiple Databases with Active Recordの修正です。

Merge pull request #40370 from eileencodes/granular-role-and-shard-swappingで追加された、abstract class毎にconnectionを切り替える方法についてのdocを追加しています。


Revert "Raise when calling render with invalid options"

renderに不正なオプションを指定した場合にexception(ArgumentError)をraiseするよう修正した、Merge pull request #39497 from jhawthorn/render_with_invalid_optionsをRevertしています。breaking changeになってしまった(gemによっては、複数のformatをサポートする為に不正な引数を指定している事がある)為。


Add option to mute multiple database yaml warning

Active Recordの修正です。

multiple databases用taskを定義する為のdatabase yamlのパース処理に失敗した場合のメッセージ出力処理を、config(config.active_record.suppress_multiple_database_warning)で抑止出来るよう修正しています。


Merge pull request #40368 from eugeneius/shard_test_transactions

activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rbactiverecord/lib/active_record/test_fixtures.rbの修正です。

テスト実行時に、shards用のtransactionをfixtureのsetup時点で開始するよう修正しています。


Implement connecting_to method

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

指定されたconnectionを使用する為のconnecting_toメソッドを追加しています。

consoleをreadonly modeで起動する、のように、特定のconnectionが必ず使用されている状態にする為のメソッド、との事です。


Only replace existing pools in transactional tests

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

transactional testsでreading connection pools をwriting connection poolsに置き換える処理で、reading connectionが無い場合置き換え処理を行わないよう修正しています。


Merge pull request #39718 from jonathanhefner/listen-on-fork

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

EventedFileUpdateCheckerでの変更チェックがpidに依存していた(ファイルの変更処理で、pidが変わったらlistenの再チェックを行ってた)のを、forkが行われた場合、fork直後にlistenの再チェックを行うよう修正しています。

forkを行うgem(e.g. spring)を使っている場合に変更検知が正しく行えるようにする為。


Merge pull request #39705 from Shopify/actioncontroller-testcase-parameters-fix

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

ActionController::TestCase#processでparameterのJSONへの変換処理が正しく行われないバグがあったのを修正しています。


Share connection pools for non-default shards

activerecord/lib/active_record/connection_adapters/legacy_pool_manager.rbactiverecord/lib/active_record/test_fixtures.rbの修正です。

legacy_connection_handlingがtrueの場合、defaultのsharsのconnectionのみがshareされてしまうバグがあったのを修正しています。


Remove deprecated ActionDispatch::Http::ParameterFilter

Action Packの修正です。

deprecatedになっていたActionDispatch::Http::ParameterFilterを削除しています。


Remove deprecated support to call private methods from object in some view helpers

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

deprecatedになっていたview helperからprivateメソッドを呼び出せるようにする為の処理を削除しています。


Make type a required argument in ActionView::Template::HTML#initialize

actionview/lib/action_view/template/html.rbの修正です。

ActionView::Template::HTML#initializetype引数を必須引数に修正しています。


Remove deprecated pattern argument in ActionView::Template::PathResolver

actionview/lib/action_view/template/resolver.rbactionview/lib/action_view/testing/resolvers.rbの修正です。

deprecatedになっていたActionView::Template::PathResolverpattern引数を削除しています。


Remove support to template handlers that don't accept two arguments

actionview/lib/action_view/template.rbactionview/lib/action_view/template/handlers.rbの修正です。

deprecatedになっていたtemplate handlerに2つ未満の引数を指定した場合の処理を削除しています。


Remove deprecated support to passing relative paths to render file:

actionview/lib/action_view/renderer/template_renderer.rbの修正です。

deprecatedになっていたrenderfileオプションに相対パスを指定した場合の処理を削除しています。


Remove deprecated support to passing absolute paths to render template:

actionview/lib/action_view/renderer/template_renderer.rbの修正です。

deprecatedになっていたrendertemplateオプションに絶対パスを指定した場合の処理を削除しています。


Remove deprecated support to calling ActionView::ViewPaths#with_fallback with a block

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

deprecatedになっていたActionView::ViewPaths#with_fallbackにblockを指定した場合の処理を削除しています。


Remove deprecated finalize_compiled_template_methods

actionview/lib/action_view/railtie.rbactionview/lib/action_view/template.rbの修正です。

deprecatedになっていたActionView::Template.finalize_compiled_template_methodsを削除しています。


Make locals argument required on ActionView::Template#initialize

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

ActionView::Template#initializelocal引数を必須引数に修正しています。


Remove deprecated ActionView::Template#updated_at

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

deprecatedになっていたActionView::Template#updated_atを削除しています。


Remove deprecated ActionView::Template#virtual_path=

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

deprecatedになっていたActionView::Template#virtual_path=を削除しています。


Remove deprecated ActionView::Template#formats

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

deprecatedになっていたActionView::Template#formatsを削除しています。


Remove deprecated ActionView::Template#variants

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

deprecatedになっていたActionView::Template#variantsを削除しています。


Remove deprecated ActionView::Template#original_encoding

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

deprecatedになっていたActionView::Template#original_encodingを削除しています。


Remove deprecated ActionView::Template#refresh

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

deprecatedになっていたActionView::Template#refreshを削除しています。


Remove deprecated format argument ActionView::Base#initialize

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

deprecatedになっていたActionView::Base#initializeformats引数を削除しています。


Remove deprecated support to pass an object that is not a ActionView::LookupContext as the first argument in ActionView::Base#initialize

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

deprecatedになっていた、ActionView::Base#initializeの最初の引数にActionView::LookupContextのobject以外の値を指定した場合の処理を削除しています。


Make the arguments of ActionView::Base#initialize required

actionpack/lib/action_dispatch/middleware/debug_view.rbactionview/lib/action_view/base.rbの修正です。

ActionView::Base#initializeの引数を全て必須引数に修正しています。


Require that ActionView::Base subclasses implement #compiled_method_container

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

ActionView::Baseのサブクラスでcompiled_method_containerメソッドが実装されていない場合、エラーになるよう修正しています。


Remove deprecated find_file from ActionView::ViewPaths

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

deprecatedになっていたActionView::ViewPathsfind_fileを削除しています。


Remove deprecated rendered_format from ActionView::LookupContext

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

deprecatedになっていたActionView::LookupContextrendered_formatを削除しています。


Remove deprecated find_file from ActionView::PathSet

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

deprecatedになっていたActionView::PathSetfind_fileを削除しています。


Remove deprecated formats from ActionView::Template::Text

actionview/lib/action_view/template/text.rbの修正です。

deprecatedになっていたActionView::Template::Textformatsを削除しています。


Remove deprecated formats from ActionView::Template::RawFile

actionview/lib/action_view/template/raw_file.rbの修正です。

deprecatedになっていたActionView::Template::RawFileformatsを削除しています。


Remove deprecated formats from ActionView::Template::HTML

actionview/lib/action_view/template/html.rbの修正です。

deprecatedになっていたActionView::Template::HTMLformatsを削除しています。


Remove deprecated find_all_anywhere from ActionView::Resolver

actionview/lib/action_view/template/resolver.rbの修正です。

deprecatedになっていたActionView::Resolverfind_all_anywhereを削除しています。


Remove deprecated escape_whitelist from ActionView::Template::Handlers::ERB

actionview/lib/action_view/template/handlers/erb.rbの修正です。

deprecatedになっていたActionView::Template::Handlers::ERBescape_whitelistを削除しています。


Return false when enqueuing a job is aborted

activejob/lib/active_job/callbacks.rbactivejob/lib/active_job/enqueuing.rbの修正です。

enqueuing jobがabortした場合、falseを返すよう修正、及び、config.active_job.return_false_on_aborted_enqueue configをdeprecateにしています。


Remove deprecated support for using unsafe raw SQL in ActiveRecord::Relation methods

Active Recordの修正です。

deprecatedになっていたActiveRecord::Relationのメソッドでunsafeなraw SQLを指定した場合のサポートを削除、及び、ActiveRecord::Base.allow_unsafe_raw_sqlをdeprecateにしています。


Remove deprecated ActiveRecord::Result#to_hash method

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

deprecatedになっていたActiveRecord::Result#to_hashメソッドを削除しています。


where.not now generates NAND predicates instead of NOR

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

where.notで実行するSQLをNORからNANDに修正しています。


Remove deprecated methods from ActiveRecord::DatabaseConfigurations

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

deprecatedになっていたActiveRecord::DatabaseConfigurationsfetcheachfirstvalues[]=メソッドを削除しています。


Implicit scoping does no longer leak scope to class level querying methods

Active Recordの修正です。

named scopeをchainした際に、scopeをclass levelのメソッドにリークしないよう修正、及び、relation.createの initialization block / callbackでscopeをclass levelのメソッドにリークしないよう修正しています。


Remove deprecated config.active_record.sqlite3.represent_boolean_as_integer

activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rbactiverecord/lib/active_record/railtie.rbの修正です。

deprecatedになていたconfig.active_record.sqlite3.represent_boolean_as_integerを削除しています。


Remove deprecated migrations_path argument in ActiveRecord::ConnectionAdapter::SchemaStatements#assume_migrated_upto_version

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

deprecatedになっていたActiveRecord::ConnectionAdapter::SchemaStatements#assume_migrated_upto_versionmigrations_path引数を削除しています。


Remove deprecated ActiveRecord::Base#update_attributes and ActiveRecord::Base#update_attributes!

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

deprecatedになっていたActiveRecord::Base#update_attributesActiveRecord::Base#update_attributes!を削除しています。


Remove deprecated ActiveRecord::ConnectionAdapters::PostgreSQLAdapter#supports_ranges?

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

deprecatedになっていたActiveRecord::ConnectionAdapters::PostgreSQLAdapter#supports_ranges?を削除しています。


Remove deprecated ActiveRecord::ConnectionAdapters::AbstractAdapter#supports_foreign_keys_in_create?

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

deprecatedになっていたActiveRecord::ConnectionAdapters::AbstractAdapter#supports_foreign_keys_in_create?を削除しています。


Remove deprecated ActiveRecord::ConnectionAdapters::AbstractAdapter#supports_multi_insert?

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

deprecatedになっていたActiveRecord::ConnectionAdapters::AbstractAdapter#supports_multi_insert?を削除しています。


Remove deprecated methods from ActiveRecord::ConnectionAdapters::DatabaseLimits

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

deprecatedになっていたActiveRecord::ConnectionAdapters::DatabaseLimitscolumn_name_lengthtable_name_lengthcolumns_per_tableindexes_per_tablecolumns_per_multicolumn_indexsql_query_lengthjoins_per_query`を削除しています。


Remove deprecated ActiveStorage::Downloading

deprecatedになっていたActiveStorage::Downloadingを削除しています。


Remove deprecated config.active_storage.queue

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

deprecatedになっていたconfig.active_storage.queueを削除しています。


MySQL: Uniqueness validator now respects default database collation

Active Recordの修正です。

uniqueness validatorで、強制的にcase sensitiveな比較を行っていたのを、行わないよう修正しています。


Remove deprecated ActiveStorage::Transformers::MiniMagickTransformer

Active Storageの修正です。

deprecatedになっていたActiveStorage::Transformers::MiniMagickTransformerを削除しています。


Remove warning of undefined instance variable

activestorage/lib/active_storage/previewer/mupdf_previewer.rbの修正です。

undefined instance variableのwarningが出ていたのを修正しています。


Remove deprecated support to pass :combine_options operations to ActiveStorage::Transformers::ImageProcessing

activestorage/lib/active_storage/transformers/image_processing_transformer.rbの修正です。

deprecatedになっていたActiveStorage::Transformers::ImageProcessing:combine_options operationを渡した場合の処理を削除しています。


Change ActionDispatch::Response#content_type to return the full Content-Type header

Action Pack、railtiesの修正です。

ActionDispatch::Response#content_typeの戻り値をContent-Type headerの値をそのまま返すよう修正、及び、config.action_dispatch.return_only_media_type_on_content_type configをdeprecateにしています。


Remove deprecated fallback to I18n.default_local when config.i18n.fallbacks is empty

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

deprecatedになっていたconfig.i18n.fallbacksが空だった場合の処理を削除しています。


Remove deprecated LoggerSilence constant

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

deprecatedになっていたLoggerSilenceを削除しています。


Remove deprecated ActiveSupport::LoggerThreadSafeLevel#after_initialize

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

deprecatedになっていたActiveSupport::LoggerThreadSafeLevel#after_initializeを削除しています。


Remove deprecated Module#parent_name, Module#parent and `Module#parents

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

deprecatedになっていたModule#parent_nameModule#parentModule#parentsを削除しています。


Remove deprecated file active_support/core_ext/module/reachable

deprecatedになっていたactive_support/core_ext/module/reachableを削除しています。


Remove deprecated file active_support/core_ext/numeric/inquiry

deprecatedになっていたactive_support/core_ext/module/deprecationを削除しています。


Remove deprecated file active_support/core_ext/array/prepend_and_append

deprecatedになっていたactive_support/core_ext/array/prepend_and_appendを削除しています。


Remove deprecated file active_support/core_ext/hash/compact

deprecatedになっていたactive_support/core_ext/hash/compactを削除しています。


Remove deprecated file active_support/core_ext/hash/transform_values

deprecatedになっていたactive_support/core_ext/hash/transform_valuesを削除しています。


Remove deprecated file active_support/core_ext/range/include_range

deprecatedになっていたactive_support/core_ext/range/include_rangeを削除しています。


Remove deprecated ActiveSupport::Multibyte::Chars#consumes? and ActiveSupport::Multibyte::Chars#normalize

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

deprecatedになっていたActiveSupport::Multibyte::Chars#consumes?ActiveSupport::Multibyte::Chars#normalizeを削除しています。


Remove deprecated methods in ActiveSupport::Multibyte::Unicode

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

deprecatedになっていたActiveSupport::Multibyte::Unicode.pack_graphemesActiveSupport::Multibyte::Unicode.unpack_graphemesActiveSupport::Multibyte::Unicode.normalizeActiveSupport::Multibyte::Unicode.downcaseActiveSupport::Multibyte::Unicode.upcaseActiveSupport::Multibyte::Unicode.swapcaseを削除しています。


Deprecate ActiveSupport::Multibyte::Unicode.default_normalization_form

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

ActiveSupport::Multibyte::Unicode.default_normalization_formをdeprecateにしています。


Remove deprecated ActiveSupport::Notifications::Instrumenter#end=

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

deprecatedになっていたActiveSupport::Notifications::Instrumenter#end=を削除しています。


Remove depreated rake notes tasks

railtiesの修正です。

deprecatedになっていたrake notes taskを削除しています。


Remove deprecated connection option in the rails dbconsole command

railties/lib/rails/commands/dbconsole/dbconsole_command.rbの修正です。

deprecatedになっていたrails dbconsoleconnectionオプションを削除しています。


Remove deprecated SOURCE_ANNOTATION_DIRECTORIES ENV

railties/lib/rails/commands/notes/notes_command.rbの修正です。

deprecatedになっていたrails notesSOURCE_ANNOTATION_DIRECTORIES envのサポートを削除しています。


Remove deprecated server argument from the rails server command

railties/lib/rails/commands/server/server_command.rbの修正です。

deprecatedになっていたrails serverserverオプションを削除しています。


Remove deprecated support for using the HOST environment variable to specify the server IP

railties/lib/rails/commands/server/server_command.rbの修正です。

deprecatedになっていたrails serverHOSTenvironmentのサポートを削除しています。


Remove deprecated rake dev:cache tasks

railtiesの修正です。

deprecatedになっていたrake dev:cache taskを削除しています。


Remove deprecated rake routes tasks

railtiesの修正です。

deprecatedになっていたrake routes taskを削除しています。


Remove deprecated rake initializers tasks

railtiesの修正です。

deprecatedになっていたrake initializers taskを削除しています。


Remove deprecated required option on the model generators

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

deprecatedになっていたmodel generatorのrequiredオプションを削除しています。


Remove unneeded requires

railtiesの修正です。

各ファイルから使用していないrequireを削除しています。


Customise the header name for ActionDispatch::RequestId

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

X-Request-Id headerのヘッダー名をconfig(config.action_dispatch.request_id_header)で指定出来るよう修正しています。


Optimise length of default index name for polymorphic references

activerecord/lib/active_record/connection_adapters/abstract/schema_definitions.rbactiverecord/lib/active_record/migration/compatibility.rbの修正です。

polymorphic referencesで使用するindexにtypeidカラムを使用していたのをreference nameを使用するよう修正しています。typeidを使用するとindex名が長くなりすぎてしまう為。


Always ask for a header argument in ResquestId middleware

actionpack/lib/action_dispatch/middleware/request_id.rbactionpack/lib/action_dispatch/railtie.rbの修正です。

ActionDispatch::RequestId#initializeのheader引数を必須引数に変更しています。


Merge pull request #39746 from jonathanhefner/springy-boot

railtiesの修正です。

Spring用のbinstubをSpring gem経由で生成していたのをやめて、Rails側で独自のbinstubを保持するよう修正、及び、そのbinstub内でGemfile.lockにSpringが記載されている場合のみSpringのロード処理を行うよう修正しています。


Remove frozen_string_literal from generated file

railties/lib/rails/generators/rails/app/templates/config/boot.rb.ttの修正です。

generated fileからfrozen_string_literalを削除しています。


Merge pull request #40456 from kamipo/attribute_for_database

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

attribute methodにattribute_for_databaseメソッドを追加しています。名前の通りdatabase用のattributeを取得する為のメソッドで、enumの指定された値(実際に保存される値)を取得出来るようになっています。


Merge pull request #40222

Action Textの修正です。

Action Textの初期化処理がApplicationControllerが定義されている事を前提とする処理になっていたのを、ApplicationController無しで(内部で独自のrenderを作成して)処理が行えるよう修正しています。


Fix deprecation will be removed version s/Rails 6.1/Rails 6.2/

Rails 6.1で削除されなかったdeprecateメソッドで表示するdeprecationメッセージ内の、削除予定RailsのバージョンをRails 6.2に修正しています。


Add author credit for #39599 [ci skip]

activerecord/CHANGELOG.mdの修正です。

Add a setting to specify that all string columns should be immutableの対応のCHANGELOGのcreditに実際に対応を行った方の名前を追加しています。


Add major features to the 6.1 release notes

rails guideのRuby on Rails 6.1 Release Notesの修正です。

Rails 6.1のmajor featuresについての記載を追加しています。


Correct some entries section from Removals to Notable changes [ci skip]

rails guideのRuby on Rails 6.1 Release Notesの修正です。

CHANGELOGエントリーの記載する箇所を間違えている箇所があったのを修正しています。


Merge pull request #39550 from vipulnsward/expiry-fix

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

ActiveSupport.use_standard_json_time_formatにfalseを指定している場合、metadataのexpiresのパース時にTime.iso8601ではなくTime.parseを使用するよう修正しています。


Revert "Add test to make sure this method will not be removed again"

ActiveModel::Attributes内の使用していないメソッドを削除した、Remove unused internal methods in ActiveModel::AttributesをRevertした、Revert "Remove unused internal methods in ActiveModel::Attributes"をRevertしています。

元々Public APIではなかった、かつ、これらのメソッドを使用するユースケースは無いはず、との事で再度削除されています。


Serialize aria- namespaced list attributes

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

ARIA Array / Hash attributesをspace区切りの値として扱うよう修正しています。

tag.input type: 'checkbox', name: 'published', aria: {
  invalid: @post.errors[:published].any?,
  labelledby: ['published_context', 'published_label'],
  describedby: { published_errors: @post.errors[:published].any? }
}
#=> <input type="checkbox" name="published" aria-invalid="true" aria-labelledby="published_context published_label" aria-describedby="published_errors">

Fix tests with Ruby 3

actionpack/test/dispatch/request_id_test.rbの修正です。

stub_requestへの引数の指定方法に誤りがあったのを修正しています。


Add more tests for find_signed/! methods

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

find_signed(!)メソッドについて、primary keyをcustomしている場合、STIを使用している場合、等のテストを追加しています。


Merge pull request #40448 from BKSpurgeon/fix-timezone-rounding-bug

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

ActiveSupport::TimeWithZoneのオブジェクトに対してTime.atを実行した場合に、正しい結果が取得出来ないバグ(precisionの取得方法に誤りがあった)があったのを修正しています。


Fixup test for TimeWithZone Time.at precision

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

ActiveSupport::TimeWithZoneのオブジェクトに対してTime.atを実行した場合のテストについて、でテスト名を正しい名前に修正、不要なコードの削除等をおこなっています。


Add docs and guards to while_preventing_writes

activerecord/lib/active_record/connection_adapters/abstract/connection_pool.rbactiverecord/lib/active_record/connection_handling.rbの修正です。

while_preventing_writesメソッドにdocを追加、及び、サポートしていない状態でwhile_preventing_writesメソッドを実行された場合にexceptionをraiseするよう修正しています。