なるようになるブログ

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

rails commit log流し読み(2019/03/12)

rails commit log流し読み(2019/03/12)

2019/03/12分のコミットです。

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

activemodel/CHANGELOG.md

activesupport/CHANGELOG.md


Merge pull request #35485 from excid3/default-attachable-trix-partial

actiontext/lib/action_text/attachable.rbの修正です。

ActionText::Attachable moduleにto_trix_content_attachment_partial_pathメソッド(Trixでattachementを表示する際に使用するメソッド)を定義し、ActionText::Attachableをincludeしているmodelで同じpathを参照するよう修正しています。


Add locale option to parameterize

activesupport/lib/active_support/core_ext/string/inflections.rbactivesupport/lib/active_support/inflector/transliterate.rbの修正です。

String#parameterize、及び、ActiveSupport::Inflector#parameterizeActiveSupport::Inflector#transliterateメソッドの引数にlocaleオプションを追加しています。これらのメソッドは最終的にI18n.transliterateを呼ぶようになっているのですが、I18n.transliterateでは元々localeを指定出来るようになっており、オプションをそのまま渡すようになっています。


Merge pull request #34965 from bogdanvlviv/improve-rails-encrypted--help

railties/lib/rails/commands/encrypted/USAGErailties/lib/rails/commands/encrypted/encrypted_command.rbの修正です。

encryptedコマンド用のUSAGEファイルを追加し、encryptedコマンドのヘルプでコマンドについての詳細を表示するよう修正しています。


[ci skip] Improve encrypted commands USAGE

railties/lib/rails/commands/encrypted/USAGEの修正です。

encryptedコマンドのUSAGEにEncryption Keysについての詳細な説明を追加、及び、各箇所の言い回し等を修正しています。


Merge pull request #34955 from bogdanvlviv/follow-up-33962

Restructure credentials after environment overrides.のfollow upとして、rails guideのConfiguring Rails Applicationsconfig.credentials.content_path、及び、config.credentials.key_pathについての説明を追加、及び、各箇所のタイポを修正しています。


Fix bug with parametrize when locale is passed

Active Supportの修正です。

先のlocaleオプションを追加した対応で、オプションの指定方法が誤っていた箇所があったのを修正、及び、全く無かったテストを追加しています。


Do not generate dummy string when the tag used is not the <%=

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

Load YAML for rake tasks without parsing ERBでDB用のtaskをロードする際にdatabase.ymlをERBのパース無しで読み込むようにしたのですが、それだと逆にERBを使用して動的にdatabase.ymlを生成している際に困る、という問題が発生しました。

その対応として、タグが<%=を使用している場合のみダミー文字列を使用する(ERBのパースを行わない)よう修正を行うようにしています。


overriden -> overridden [ci skip]

railties/lib/rails/commands/encrypted/USAGEの修正です。

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


bump Zeitwerk to 1.3.3

activesupport/activesupport.gemspecの修正です。

zeitwerkのバージョンを>= 1.3.3に修正しています。


Merge pull request #35424 from Korri/validation-rules-locale-fallback

activemodel/lib/active_model/errors.rbの修正です。

error messageをi18nで変換する際に、他のロケールを見るより先にgeneric messageにフォールバックしていたのを、他のロケールの値を確認するよう修正しています。

例えば、Product modelのtitle attributeでblankエラーがen-US localeで発生した場合のi18nのルックアップ処理が、以下のように変更されています。

before

en-US.activerecord.errors.models.product.attributes.title.blank
en-US.activerecord.errors.models.product.blank
en-US.activerecord.errors.messages.blank
en-US.errors.attributes.title.blank
en-US.errors.messages.blank

en.activerecord.errors.models.product.attributes.title.blank
en.activerecord.errors.models.product.blank
en.activerecord.errors.messages.blank
en.errors.attributes.title.blank
en.errors.messages.blank

after

en-US.activerecord.errors.models.product.attributes.title.blank
en-US.activerecord.errors.models.product.blank
en-US.activerecord.errors.messages.blank

en.activerecord.errors.models.product.attributes.title.blank
en.activerecord.errors.models.product.blank
en.activerecord.errors.messages.blank

en-US.errors.attributes.title.blank
en-US.errors.messages.blank

en.errors.attributes.title.blank
en.errors.messages.blank

Add changelog entry for transliterate/parameterize accepting locale [ci skip]

activesupport/CHANGELOG.mdの修正です。

transliterateとparameterizelocale`オプションを指定出来るようにした対応について、CHANGELOGにエントリーを追加しています。


Add note about has_many associations callbacks [ci skip]

rails guideのActive Record Associationsの修正です。

Association Callbacksの項に、association callbackはassociationが追加 / 削除された時だけ実行される旨説明を追加しています。


After https://github.com/rails/rails/pull/35281 and https://github.com/rails/rails/pull/35036 AV warns about not having the compiled container.

guides/rails_guides/generator.rbの修正です。

guideのgeneratorでtemplate cacheに関するwarningが出ていたので、with_empty_template_cacheメソッドを使用してインスタンスを生成するよう修正しています。


Show friendly message to install action mailbox if the related table does not exist

actionpack/lib/action_dispatch/middleware/templates/rescues/invalid_statement.html.erbactionpack/lib/action_dispatch/middleware/templates/rescues/invalid_statement.text.erbの修正です。

エラーページを表示する際に、エラーがAction Mailboxのテーブルが無い事によるエラーだった場合、エラーページにrails action_mailbox:installを実行すれば解決する旨説明を記載するよう修正しています。


Add additional ERB DummyCompiler tests

railties/test/application/rake/dbs_test.rbの修正です。

ERB DummyCompiler(database.ymlをERBのパース無しで読み込む際に使用する為のクラス)についてのテストを追加しています。


Edit a changelog entry [ci skip]

activemodel/CHANGELOG.mdの修正です。

CHANGELOG entryのグラマーの修正を行っています。


Change wording of some instances of 'opt out' [ci skip]

docの修正です。

各箇所のグラマーの修正を行っています。