なるようになるブログ

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

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

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

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

railties/CHANGELOG.md


fix broken handling of unknown http methods

actionpack/lib/action_dispatch/http/request.rbrailties/lib/rails/rack/logger.rbの修正です。

requestに不正なHTTPメソッドが指定された場合に、405(Method Not Allowed)ではなく、500(Internal Server Error)が返ってしまうバグがあったのを修正しています。


Don't dup schema cache before assigning it

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

schema cache dumpを使用する際に、不要なdupを行わないよう修正しています。


Don't enable Zeitwerk on MRI in 6.1 load_defaults

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

6.1向けのload_defaultsの処理から不要なZeitwerkの設定処理を削除しています。6.0で既に設定済みな為。


Use index_with in ActiveRecord::Core#slice

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

ActiveRecord::Core#sliceメソッドでオブジェクトの生成を減らすよう修正しています。


Remove impossible new_record? autosave check

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

save_has_one_associationメソッドから不要なnew_record?のチェックを削除しています。save_has_one_associationafter_createafter_update callbackからのみ呼ばれ、new_record?は必ずfalseになる為。

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

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

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


Re-enable Layout/SpaceAroundOperators cop

Rubocopのバージョンを1.0.0に更新、及び、再度Layout/SpaceAroundOperators copを有効化しています。Layout/SpaceAroundOperators copは幾つかのケースでfalse positiveが発生してしまう事がある為無効化していたのですが、1.0.0でその問題が解決した為。

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

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

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

activesupport/CHANGELOG.md


fix boolean negation in documentation activerecord/lib/active_record/associations/collection_association.rbguides/source/api_documentation_guidelines.mdのdocの修正です。

CollectionAssociation#empty?メソッドのdoc内の、同等の処理について説明している箇所にタイポがあったのを修正しています。


Document Testing::SimpleStubs

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

ActiveSupport::Testing::SimpleStubsクラス内の各メソッドにdocを追加しています。


Instrument cache store name

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

Cacheのinstrumentのpayloadにstore nameを追加しています。


Speed up ActiveSupport::SecurityUtils.fixed_length_secure_compare

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

ActiveSupport::SecurityUtils.fixed_length_secure_compareで、OpenSSL.fixed_length_secure_compareを使用するよう修正しています。OpenSSL.fixed_length_secure_compareの方が高速(Cでの実装)な為。

OpenSSL.fixed_length_secure_compareが使用出来ない場合は、元々あったRubyの実装が使用されるようになっています。


Remove redundant begin blocks

各箇所から不要なbegin blockを削除しています。


Document for cache store name instrumentation [ci skip]

rails guideのActive Support Instrumentationの修正です。

cache関連のinstrumentのpayloadに、store nameの説明を追加しています。

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

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

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

activesupport/CHANGELOG.md

railties/CHANGELOG.md


Handle port-less $MEMCACHE_SERVERS in MemCacheStore tests

actionpack/test/dispatch/session/mem_cache_store_test.rbactivesupport/test/cache/stores/mem_cache_store_test.rbの修正です。

MemCacheStoreのテストを、MEMCACHE_SERVERSにportの指定が無い場合でも動作するよう修正しています。


Merge pull request #40420 from sambostock/use-dalli-fallback

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

ActiveSupport::Cache::MemCacheStoreをaddressesの指定無しで使用した場合、最初にlocalhost:11211をaddressとして使用するようになっていたのを、先にENV["MEMCACHE_SERVERS"]を確認し、ENV["MEMCACHE_SERVERS"]の指定が無い場合にlocalhost:11211を使用するよう修正しています。


Refactor railsrc file location to be xdg compliant (#39411)

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

railsrcをチェックする先が~/.railsrc固定だったのを、先に$XDG_CONFIG_HOME/rails/railsrc、及び、~/.config/rails/railsrcをチェックするよう修正しています。

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

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

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

activerecord/CHANGELOG.md


Add values_at attribute method for active_record

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

Active Recordのインスタンスに、指定されたメソッドに関連付けられた値を取得する為のvalues_atメソッドを追加しています。

topic = Topic.first
topic.values_at(:title, :author_name)
# => ["Budget", "Jason"]

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

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

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

activerecord/CHANGELOG.md


Merge pull request #40371 from shouichi/document-transform-event

rails guideのActive Support Instrumentationの修正です。

Active Storageセクションにtransform.active_storage eventを追加しています。


Fix read_attribute_before_type_cast to consider attribute aliases

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

read_attribute_before_type_castにaliased attributeを指定した場合に正しい結果が取得出来ないバグがあったのを修正しています。