なるようになるブログ

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

rails commit log流し読み(2021/01/05)

2021/01/05分のコミットです。

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


actionpack: Improve performance by allowing routes with custom regexes in the FSM.

Action Packの修正です。

routingのFSMで、custom regexepを指定してのroutingを行えるよう修正しています。

元々は、FSMではデフォルトの正規表現を持つパラメータのみ指定出来、それ以外の正規表現が含まれている場合、root listに対してlinear searchを行っていました。

この対応により、FSMでデフォルト以外の正規表現も検索出来るようになった為、cutom regexepを指定した場合のrouting処理の性能が改善するようになっています。


rails guideのConfiguring Rails Applicationsの修正です。

Results of config.load_defaultsの項に説明が不足してたconfigがあったのを追加、及び、load_defaultsでデフォルトが変わるconfigについては、Results of config.load_defaultsにのみデフォルト値の説明を行うよう修正しています。


Fix complicated has_many through with nested where condition

Active Recordの修正です。

has_many through associationを使用していて、through associationでnestしたwhere conditionを指定、かつ、through scopeでreferences valuesを使用している、かつ、modelがテーブルと同じ名前のassociationが定義されていない場合に、エラーになってしまうバグがあったのを修正しています。


Avoid nokogiri v1.11.0 to make our CI green

Gemfileの修正です。

nokogiri v1.11.0を使用しないよう修正しています。nokogiri v1.11.0だとActive Supportのテストがfailしてしまう為。

rails commit log流し読み(2021/01/04)

2021/01/04分のコミットです。

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


Upload raw email before creating pending ActionMailbox::InboundEmail

actionmailbox/app/models/action_mailbox/inbound_email/message_id.rbの修正です。

Action Mailboxで受信したメールのデータを作成する際に、storageへのuploadを先に行ってからActionMailbox::InboundEmailのレコードを作成するよう修正しています。

ActionMailbox::InboundEmailのレコードを先に作ってしまうと、メールのstorageへのupload処理でエラーになった場合に、処理がされない不正なレコードが残ってしまう為。

rails commit log流し読み(2021/01/03)

2021/01/03分のコミットです。

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


Merge pull request #40996 from eugeneius/calculations_payload_name

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

calculation queriesを実行した場合のpayoad nameに、model名と実行したcalucation名を含むよう修正しています。

rails commit log流し読み(2021/01/02)

2021/01/02分のコミットです。

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


Populate ARGV for app template

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

Rails 6.1で、templateで引数に指定した値がARGV経由で取得出来ないバグがあったのを修正しています。


Update stale issue comment to mention 6-1-stable

.github/stale.ymlの修正です。

issueにするコメント内のRailsのバージョンを6.1に更新しています。


timestamp_attributes_for_update_in_model is a public method

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

public methodであるtimestamp_attributes_for_update_in_modelを使用するのにsendを使用していたのを、メソッドを直接呼び出すよう修正しています。

rails commit log流し読み(2021/01/01)

2021/01/01分のコミットです。

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


Bump license years to 2021 [ci skip]

各ファイルのlicense yearsを2021に更新しています。


Should not fail if mangling enum names collision

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

enumのメソッドを定義する際に、同一のメソッドが既に存在していても、そのメソッドが同じenumにより定義されたメソッドの場合、エラーにならないよう修正しています。

rails commit log流し読み(2020/12/31)

2020/12/31分のコミットです。

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


Fix broken link for free programming books [ci-skip]

rails guideのGetting Started with Railsの修正です。

List of Free Programming Booksへのリンクが壊れていたのを修正しています。


Merge pull request #40974 from kamipo/dont_mangle_enum_names_for_unicode_letters

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

enumの値をメソッド用にサニタイズする際に、メソッド名として使用出来るUnicode charactersまでサニタイズしていたのを、Unicode charactersについてはサニタイズしないよう修正しています。


Clarify use of rescue_from [ci skip]

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

rescue_fromメソッドのdocで、rescue_fromはcontroller向けの処理である旨説明がされていたのですが、実際はそうではない為、該当部分の説明を修正しています。


Merge pull request #40981 from mkasztelnik/40900-fix-lazy-translation-in-partial-with-block

Action Viewの修正です。

@virtual_path変数を削除した、Remove redundant @virtual_path variableをRevertしています。

@current_template経由でvirtual_pathにアクセス出来るから不要だろう、という事で削除されたのですが、@current_template経由で値を取得すると、partial内でtranslationを呼び出した際のscopeが変わってしまい、既存のアプリに影響が出てしまった為、元の挙動を維持する為Revertしています。


fix CHANGELOG entry for #40768

activerecord/CHANGELOG.mdの修正です。

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

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

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

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

activerecord/CHANGELOG.md

actiontext/CHANGELOG.md


Add changelog entry for #40961

activemodel/CHANGELOG.mdの修正です。

ActiveModel::Name#initializeの引数にlocaleを追加した、add locale argument to ActiveModel::Name initializeの対応についてCHANGELOGにエントリーを追加しています。


Merge pull request #40768 from kivikakk/only

Active Recordの修正です。

FinderMethodsに、1レコードを取得、かつ、レコードが1つじゃない場合にexceptionをraiseする、solefind_sole_byメソッドを追加しています。

Product.where(["price = %?", price]).sole
# => ActiveRecord::RecordNotFound      (指定されたpriceのProductが見つからなかった場合)
# => #<Product ...>                    (指定されたpriceのProductが1つだけあった場合)
# => ActiveRecord::SoleRecordExceeded  (指定されたpriceのProductが複数あった場合)

user.api_keys.find_by_sole(key: key)

Merge pull request #40306 from cindysx89/ensure_db_dir

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

dump_schemaメソッドでschema作成する前に、dbディレクトリを作成するよう修正しています。


Deprecate unused method

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

使用していないschema_fileメソッドをdeprecateにしています。


Add test coverage for dump_filename

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

dump_filenameメソッドについてのテストを追加しています。


Make sure db:prepare works even the schema file doesn't exist

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

db:previewableでdatabaseが無い、かつ、schemaファイルが無い場合にエラーになっていたのを、db:migrateを実行するよう修正しています。


Extract method to the DatabaseTasks class

activerecord/lib/active_record/railties/databases.rakeactiverecord/lib/active_record/tasks/database_tasks.rbの修正です。

db:prepare taskの処理をDatabaseTasksクラスのメソッドに切り出しています。


Extract method to get all configs for AtiveRecord::Base

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

configsの取得処理をメソッドに切り出しています。


Call method locally inside the class

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

同じクラス内のメソッドを呼び出す際に、不要なクラスの指定を削除しています。


Merge pull request #40946 from kylekeesling/master

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

form_withがデフォルトでnon-remoteなformを生成するようになった(Change form_with to generate non remote forms by default)のに合わせて、form_withform_forメソッドのdocの説明を修正しています。


Merge pull request #38733 from roramirez/remove-gemlist-entry

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

使用されていない(アプリケーションから使う事が出来なかった)add_gem_entry_filterメソッドを削除しています。


Merge pull request #39567 from jonathanhefner/credentials-diff-disenroll

railtiesの修正です。

rails credentials:diff --enrollで登録した設定を解除する為のrails credentials:diff --disenrollオプションを追加しています。


Merge pull request #40919 from ghiculescu/patch-2

rails guideのCaching with Rails: An Overviewの修正です。

config.action_controller.perform_cachingを有効化する方法についての説明している箇所に、rails dev:cacheコマンドについての説明を追加しています。


[docs] Mention previewable? and variable? in Activestorage guide

rails guideのActive Storage Overviewの修正です。

preview / variant について説明する前に、representation処理について説明を行うよう修正しています。


Merge pull request #27978 from kamipo/add_blob_short_hand_method

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

binaryのaliasとしてblobメソッドを追加しています。


Use if/else instead of case without argument

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

case / whenif / elseに修正しています。


Improve ActionText extensiblibility

Action Textの修正です。

rich contentをrenderする際に、contentのスタイリング処理をユーザが独自にカスタマイズ出来るよう修正しています。

デフォルトでは今まで通りTrixが使われるようになっています。独自にカスタマイズしたい場合、app/views/layouts/action_text/contents/_content.html.erbがrenderの際にlayoutファイルとして使用されるようになっているので、そのファイルでstyleを定義すればOKです。


Add the author name for #40782 in the CHANGELOG [ci skip]

activerecord/CHANGELOG.mdの修正です。

author nameの記載が漏れているエントリーがあったのを修正しています。


Fix odd indentation [ci skip]

rails guideのGetting Started with Railsの修正です。

Using Concernsの項にあるexampleコードのインデントを修正しています。


Fix the method signature for transaction helper in CollectionAssociation

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

CollectionAssociation#transactionメソッドの引数指定が誤っていたのを修正、及び、このtransactionメソッドとは関係無いドキュメントが記載されていたのを削除しています。