なるようになるブログ

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

rails commit log流し読み(2019/01/13)

2019/01/13分のコミットです。

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


Add Exim and Qmail support to Action Mailbox

Action Mailboxの修正です。

Action MailboxにEximQmailのサポートを追加しています。

ちなみにAction Mailboxがデフォルトでサポートするサービス、エージェントはこれで最後になる予定との事。

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

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

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


Merge pull request #34902 from lanzhiheng/improve-doc-in-routing-2-10-adding-member-routes

rails guideのRails Routing from the Outside Inの修正です。

Adding Member Routesの項にあるroutingのonオプションを使用した場合の説明に、helperメソッド名も変わる旨説明を追加しています。


More exercise test cases for not_between

activerecord/lib/arel/predications.rbactiverecord/test/cases/arel/attributes/attribute_test.rbの修正です。

Support endless ranges in whereのfollow upとして、not_betweenにもendless rangeのサポートを追加、及び、テストの追加を行っています。

rails commit log流し読み(2019/01/11)

2019/01/11分のコミットです。

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

activesupport/CHANGELOG.md

activerecord/CHANGELOG.md


Move all npm packages to @rails scope

Railsで提供しているnpm packages(rails-ujsactivestorageactioncableactiontext)を、webpacker同様に@rails namespace配下に移動(@rails/actioncable@rails/actiontext@rails/activestorage@rails/ujs)しています。

名称の変更だけで実際のリリースはまだです。なお、古い名称のpackageは削除等はされないため、古いバージョンについては引き続き使用出来ます。


Add Postmark to the ingress lists [ci skip]

actionmailbox/README.mdrails guideのAction Mailbox Basicsの修正です。

サポートしているサービスのリストにPostmarkを追加しています。


Merge pull request #34892 from kbrock/safer_safe_constantize

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

不正な定数名を指定した場合に、String#safe_constantizeLoadErrorをraiseしてしまう場合があったのを、メソッド内でLoadErrorをrescueし、メソッドとしてはnilを返すよう修正しています。


Add reasoning for I18n.with_locale and explanation that the problem is

rails guideのRails Internationalization (I18n) APIの修正です。

Managing the Locale across Requestsの項に、何故I18n.with_localeメソッドを使う必要があるのかについての説明を追加しています。


Fix typo in collection_radio_buttons spec [ci skip]

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

collection_radio_buttonsメソッドのdoc内のタイポを修正しています。


Replace secrets with credentials in comments

railtiesの修正です。

database.ymlのテンプレートファイルのコメント内、センシティブな情報を扱うファイルのファイル名がconfig/secrets.ymlになっていたのを、config/credentials.ymlに修正しています。


Refactor build_relation in the uniqueness validator to avoid low level predicate construction

Active Recordの修正です。

uniqueness validatorのbuild_relationメソッドでlow levelのpredicateの組み立て処理を行わないようリファクタリングしています。


Refactor bind_attribute to expand an association to actual attribute

activerecord/lib/active_record/relation.rbactiverecord/lib/active_record/validations/uniqueness.rbの修正です。

uniqueness validatorのbuild_relationメソッドで行っていたattributeの取得処理を、relationのbind_attributeで行うようリファクタリングしています。


Fix test_case_insensitiveness to follow up eb5fef5

activerecord/test/cases/adapters/postgresql/case_insensitive_test.rbの修正です。

先の、Refactor build_relation in the uniqueness validator to avoid low level predicate constructionの修正によりtest_case_insensitivenessのテストが失敗するようになっていたのを修正しています。


Remove id_value argument which is no longer passed to sql_for_insert

activerecord/lib/active_record/connection_adapters/abstract/database_statements.rbactiverecord/lib/active_record/connection_adapters/postgresql/database_statements.rbの修正です。

PostgreSQL::DatabaseStatements#sql_for_insertメソッドの引数から使用されてないsql_for_insertを削除しています。


Add info about config.action_mailer.delivery_job to the guide [ci skip]

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

config.action_mailer.delivery_jobについての説明を追加しています。


Support endless ranges in where

activerecord/lib/arel/predications.rbの修正です。

Ruby 2.6で追加されたendless rangesのサポートを追加しています。endless rangeが指定された場合、infinityが指定されたのと同じ振る舞いをするようになっています。

# before
User.where(id: 1..).to_sql
# => "SELECT \"users\".* FROM \"users\" WHERE \"users\".\"id\" BETWEEN 1 AND NULL"


# after
User.where(id: 1..).to_sql
#=> "SELECT \"users\".* FROM \"users\" WHERE \"users\".\"id\" >= 1"

rails commit log流し読み(2019/01/10)

2019/01/10分のコミットです。

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


Merge pull request #34899 from rails/speed-up-step

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

Duration#coerceメソッドで引数がDurationの場合にscalar objectを返すよう修正しています。

Ruby 2.6でRange.new(x, y).step(Duration).each { ... }というような処理が大変遅くなってしまっており、その対応として修正を行っています。なおそれでもまだRuby 2.5よりは遅くなっています。

ただこれが本当に正しい修正かはわからなく、まだ調査は続けるとのことです。


Merge pull request #34692 from gmcgibbon/use_mail_delivery_job_in_6.0_defaults

Action Mailer、railtiesの修正です。

Merge pull request #34591 from gmcgibbon/new_delivery_jobでメールの送信に(新規に追加した)MailDeliveryJob classを使うようになっていたのですが、これもまたbreaking changeな為、デフォルトはActionMailer::DeliveryJobに戻して、new_framework_defaults_6_0.rb及びload_defaultsActionMailer::MailDeliveryJobを指定するよう修正しています。


Merge pull request #34900 from gmcgibbon/fix_test_find_only_some_columns

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

serializeのテストでテスト実行前に使用するmodelのattributesをreset_column_informationを使用してresetするよう修正しています。

attributeが残った状態のままだと以降のテストでエラーになってしまう為。


Specify the type for the auto-generated primary key

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

Schema Conventionsの項、Primary Keyについて説明している箇所に、type(bigint or integer)についての説明を追加しています。


Bring in all of aws-sdk-sns if using Amazon ingress

actionmailbox/app/controllers/action_mailbox/ingresses/amazon/inbound_emails_controller.rbの修正です。

Aws::SNS::MessageVerifierを使用する際にaws-sdk-sns/message_verifierをrequireしていたのを、aws-sdk-snsをrequireするよう修正しています。

aws-sdk-sns/message_verifierだけだとAws::SNS::MessageVerifierで使用している他のclassがrequireされない為。


Added Postmark ingress support

actionmailbox/app/controllers/action_mailbox/ingresses/postmark/inbound_emails_controller.rbactionmailbox/config/routes.rbの修正です。

Action MailboxにPostmarkのサポートを追加しています。


Tweak Postmark ingress docs [ci skip]

actionmailbox/app/controllers/action_mailbox/ingresses/postmark/inbound_emails_controller.rbのdocの修正です。

ActionMailbox::Ingresses::Postmark::InboundEmailsController classのdocの言い回しを修正しています。

rails commit log流し読み(2019/01/09)

2019/01/09分のコミットです。

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

railties/CHANGELOG.md


add new frameworks to tasks/release.rb

Rails release用のtaskにあるframeworkの一覧にAction Mailbox、Action Textを含むよう修正しています。


Merge pull request #34132 from ConfusedVorlon/enable_fragment_cache_log_in_dev

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

tmp/caching-dev.txtがある場合(dev:cache実行時)に`config.action_controller.enable_fragment_cache_logging`にもtrueを指定するよう修正しています。


Merge pull request #34890 from rosa/test-exceptions-with-all-adapters

activejob/lib/active_job/core.rbactivejob/lib/active_job/exceptions.rbの修正です。

exception counterにHash.new(0)を使用していたのを空のHash({})を使用するよう修正、及び、retry_onメソッド側でexception counterに該当のexceptionが存在しない場合に0を設定するよう修正しています。

rescue adapterを使用している場合、Hash.new(0)はseralize -> deserializeでデフォルト値無しのHashに変換されてしまう為、seralizeする前にデフォルト値を指定してもそれが使用されない為。

合わせて、exceptionのtestがtest adapterでのみ実行されていたのを、他のadapterでも実行されるよう修正しています。


The frameworks list is order dependent.

tasks/release.rbの修正です。

Rails release用のtaskでリリースするframeworkの順番を調整しています。Action MailboxはActive Recordに依存している為Active Recordを先に対応する必要がある、等の依存関係に合わせて調整しています。


Revert "Merge pull request #34387 from yhirano55/rails_info_properties_json"

rails properties routes(/rails/info/properties)にJSON formatのサポートを追加したRespond /rails/info/properties.jsonをRevertしています。

ローカル恐らくでは使用しない、かつ、development環境以外では使用出来ない(現状は)為、デフォルトではJSON formatを提供する必要は無いのでは、という結論に至った為、との事です。

が、Revertする内容が間違えており、後ほど改めてRevertは行われています。


Revert "Revert "Merge pull request #34387 from yhirano55/rails_info_properties_json""

直前のRevertをRevertしています。Revertする内容が誤っていた為。


Revert "Merge pull request #34387 from yhirano55/rails_info_properties_json"

改めて、rails properties routes(/rails/info/properties)にJSON formatのサポートを追加したRespond /rails/info/properties.jsonをRevertしています。


Preserve Bundle configuration during app generation (#34755)

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

rails newの処理中にbundlerコマンドを実行する際に、bundlerのenvが無効化されいたのを、bundlerのenvをそのまま使用するよう修正しています。

元々bundler側にバグがあってenvを無効化するようにしていた(らしい)のですが、現状その問題は解決済みのよう、かつ、envに指定したcredential情報(e.g. BUNDLE_GITHUB__COM)を使いたいので、bundlerのenvを使用出来るよう修正しています。


Merge pull request #34885 from y-yagi/fixes_34780

actionpack/lib/action_dispatch/http/cache.rbの修正です。

Cache-Control headerにpublicno-cacheを指定した場合、publicが除外されるようになってしまっていたのを、除外しないよう修正しています。publicno-cacheを同時に指定するケースは通常ありえる為。


Merge pull request #34894 from hahmed/tames-params-wrapper-errors

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

Allow rescue from parse errorsActionDispatch::Http::Parameters::ParseErrorをcontrollerのrescue_fromでキャッチ出来るよう対応したのですが、この対応では全てのexceptionをハンドリングするようになっていました。

その影響で、本来rescueすべきではないエラー(interrupt等)にまで影響が出てしまっていた為、ActionDispatch::Http::Parameters::ParseErrorのみrescueするよう処理を修正しています。


Enable Lint/DeprecatedClassMethods cop to avoid using deprecated methods

Lint/DeprecatedClassMethods copを有効化、及び、各ファイルにcopを適応しています。


Add OG tags to layout.html.erb

rails guideの修正です。

rails guideでOG tag(og:titleog:image等々)を表示するよう修正しています。


Enable Lint/UselessAssignment cop to avoid unused variable warnings (#34904)

Lint/UselessAssignment cop を有効化、及び、各ファイルにcopを適応しています。

rails commit log流し読み(2019/01/08)

2019/01/08分のコミットです。

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

activesupport/CHANGELOG.md


Merge pull request #34700 from gmcgibbon/fetch_multi_key_order

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

ActiveSupport::CacheStore#fetch_multiメソッドの戻り値がcache hit、cache missした順に値を返すようになっていたのを、引数のnamesに指定した順に値を返すよう修正しています。


Add load hook for ActionText::RichText

actiontext/app/models/action_text/rich_text.rbの修正です。

ActionText::RichText load時使用する為のaction_text_rich_text hookを追加しています。


:recycle: Fix mysql type map for enum and set

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

MySQL adapterでENUM型及びSET型のパースを行う際に、値の前にスペースがある(e.g. "ENUM ('one', 'two', 'three')")と値が正しくパース出来ないバグがあったのを修正しています。


Consolidate the duplicated code that building range predicate

Active Recordの修正です。

range predicateの生成処理について、重複している処理をまとめるようリファクタリングしています。

rails commit log流し読み(2019/01/07)

2019/01/07分のコミットです。

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


add attachments to the new inbound mail

actionmailbox/app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rbactionmailbox/app/views/rails/conductor/action_mailbox/inbound_emails/new.html.erbの修正です。

develiomentでテスト用にinbound mailを作成する際に、添付ファイルを指定出来るよう修正しています。