なるようになるブログ

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

rails commit log流し読み(2020/07/29)

2020/07/29分のコミットです。

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


Use standard config/application.rb in plugin dummy

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

dummy application用のconfig/application.rbをdummy application用に準備していたのを、rails applicationのconfig/application.rbをそのまま使用するよう修正しています。


Merge pull request #39933 from exterm/engines-are-not-applications

railties/lib/rails/generators/base.rbrailties/lib/rails/generators/rails/plugin/plugin_generator.rbの修正です。

rails engineに指定するオプションの説明にapplicationを使用していたのを、engineに修正しています。


Extract read_attribute_for_validation for per-validator customization

activemodel/lib/active_model/validations/numericality.rbactivemodel/lib/active_model/validator.rbの修正です。

attributeのread処理をメソッド(read_attribute_for_validation)に切り出しています。validation毎に処理をカスタマイズ出来るようにする為。

rails commit log流し読み(2020/07/28)

2020/07/28分のコミットです。

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


Fix flakey test due to non-deterministic order

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

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


Merge pull request #39901 from gerrywastaken/gerry/guides/improve-syntax-highlighting

guides/rails_guides/markdown/renderer.rbの修正です。

rails guideのcode highlightingにrougeを使用するよう対応した際に、jsonmarkdown等のlanguageのhighlightがされなくなっていたのを、highlightされるよう対応しています。


Move Path::Pattern factories into test helper

Action Packの修正です。

テストでしか使用されなくなっていたPath::Pattern用のfactoryメソッドを、テスト配下に移動しています。


Fix variable name in guides markdown generator

guides/rails_guides/markdown/renderer.rbの修正です。

guides markdown generatorでhighlighting処理時に参照する変数名に誤りがあったのを修正しています。


Move column_for_attribute into ModelSchema

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

AttributeMethodsに定義されていたcolumn_for_attributeメソッドをModelSchemaに移動しています。

column_for_attributeメソッドはattribute methodには関係無いメソッドで、type_for_attributeとセットでModelSchemaにあるべきだろう、という事でModelSchemaに移動しています。


a -> an [ci skip]

activerecord/lib/active_record/model_schema.rbactiverecord/lib/active_record/signed_id.rbのdocの修正です。

doc内のグラマーの修正を行っています。

rails commit log流し読み(2020/07/27)

2020/07/27分のコミットです。

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

activestorage/CHANGELOG.md


touch parent model when an attachment is purged

activestorage/app/models/active_storage/attachment.rbの修正です。

attachmentをpurgeした際に親レコードをtouchしてupdated_atを更新するよう修正しています。親レコードのデータをcache keyに使用しているような場合に、updated_atが更新されないと削除された筈のデータが表示されたままになってしまう為。


Add back decorate_attribute_type

Active Recordの修正です。

Simplify attribute type decorationで削除したdecorate_attribute_typeメソッドを戻しています。

serialize処理でしか使ってなかった為削除&serialize処理でインラインで同等の処理を実装したのですが、enumでも必要な処理だった為、メソッドを戻してそれぞれの箇所でメソッドを使用するよう修正しています。


Don't allow to mutate cached @attribute_names

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

キャッシュされた@attribute_namesをfreezeして、値を変更出来ないよう修正しています。

rails commit log流し読み(2020/07/26)

2020/07/26分のコミットです。

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

activesupport/CHANGELOG.md


Path parameter keys should always be symbols.

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

ActionController::TestCaseでrequestのformatがJSONの場合に、path_parameters keyをSymbolに変換するよう修正しています。formatがHTMLの場合の挙動と合わせる為。


prevents redundant memcached compression

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

memcachedのcompression処理がActive SupportとDalli両方で行われてしまっていたのを、Active Supportでのみ行うよう修正しています。


Fix option not being passed with fetch_multi

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

ActiveSupport::Cache::RedisCacheStorefetch_multiメソッドに指定したオプション(namespace等)がread_multiに渡されないバグがあったのを修正しています。

rails commit log流し読み(2020/07/25)

2020/07/25分のコミットです。

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

activesupport/CHANGELOG.md


prevents raw redis and memcached compression

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

RedisCacheStore / MemCacheStoreでrawで書かれたデータを読み込む際に、不要なcompression処理を行わないよう修正しています。


Add label attribute to

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

FormBuilder経由でselectタグを生成した際に、valueが空のoptionタグにlabel attributeが指定されてなかっのを、select_tagメソッド同様に空のlabelを指定するよう修正しています。


Simplify apply_{start,finish}_limit

activerecord/lib/active_record/relation/batches.rbactiverecord/lib/active_record/relation/predicate_builder.rbの修正です。

apply_{start,finish}_limitメソッド内の共通処理をメソッドに切り出しています。


Fix argument naming in AbstractStore#set_cookie

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

AbstractStore#set_cookieメソッドの引数名をオーバライドしている元のメソッドの引数名と同じにするよう修正しています。


Build symbols descending from stars with regexp

Action Packの修正です。

ast構築時にStar用のregexpを指定していたのを、初期化の段階で渡すようにして、ast構築時の処理を減らすよう修正しています。


Remove redundant column_name.to_s

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

不要なcolumn_nameのStringへの変換処理を削除しています。


Always use faster HomogeneousIn in array handler

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

array handlerでbuildする際にHomogeneousInを使用するよう修正しています。

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

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

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


Alter regexp on initialize to avoid extra ast pass

actionpack/lib/action_dispatch/routing/mapper.rbの修正です。

pathを構築するする際のastに対するループ処理を初期化時に行って、実行時のループ処理を減らすようリファクタリングしています。


Refactor process method

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

processメソッドの処理をメソッド(setup_requestprocess_controller_response)に切り出すよう修正しています。

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

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

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


Consolidate passes through path ast

actionpack/lib/action_dispatch/routing/mapper.rbの修正です。

paramsを構築するする際のastに対するループ処理を減らすようリファクタリングしています。


Deprecate arel_attribute internal API which is no longer used

Active Recordの修正です。

internal APiであるarel_attributeをdeprecateにして、arel_attributeを使用していた箇所をarel_tableを使用するよう修正しています。


Use arel_table directly instead of newly created table

Active Recordの修正です。

alias tableを作成するのに、tableのインスタンスを新規に作成していたのを、arel_tableを使用するよう修正しています。