なるようになるブログ

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

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

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

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

activerecord/CHANGELOG.md

activesupport/CHANGELOG.md

actionview/CHANGELOG.md


Handle when Spring is not installed

railties/lib/rails/generators/rails/app/templates/bin/spring.ttの修正です。

CIのようなSpringがインストールされてない環境でbin/springが実行された場合にエラーにならないよう修正しています。


Fix typos, grammar, and formatting [ci-skip]

rails guideの修正です。

各箇所のタイポ、フォーマットの修正等を行っています。


Make ActiveRecord::AttributeMethods::Query respect getter overwrites in the model

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

ActiveRecord::AttributeMethods::Queryで値を返す際に、modelでattributeと同名のメソッドが定義されている場合、そのメソッドの戻り値を返すよう修正しています。

class User
  def admin
    false
  end
end

user = User.first
user.update(admin: true)
user.admin? #=> # false

Merge pull request #40930 from agrobbin/action-dispatch-ssl-raw-request-method

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

不正なHTTPメソッドが指定されている場合に、Action Dispatch SSL middlewareでActionController::UnknownHttpMethodがraiseされてしまっていたのを修正しています。


No need to freeze constants

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

不要な定数のfreeze処理を削除しています。


Merge pull request #40215 from vlado/file_path_joining_in_generator

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

tmp配下のcaching-dev.txtをチェックする際の処理を、他の箇所と同様におこなうよう修正しています。


Merge pull request #39626 from vipulnsward/as-notification-args

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

ActiveSupport::Notification.subscribeの最初の引数に不正な値が指定された場合に、ArgumentErrorをraiseするよう修正しています。


Add CHANGELOG entry for #39626

activesupport/CHANGELOG.mdの修正です。

先のActiveSupport::Notification.subscribeの対応について、CHANGELOGにエントリーを追加しています。


Consistently render button_to as <button>

Action View、railtiesの修正です。

button_toメソッドが生成するタグが引数に指定された値によって、<input type="submit"><button type="submit">にわかれていたのを、引数の値にかかわらず<button type="submit">を生成するよう修正しています。

buttoninputではattributeの扱い方やsubmit時の挙動が違い、混乱の元となる為。

config.action_view.button_to_generates_button_tagにfalseを指定すると、元の通りinputbutton両方生成した場合生成する挙動になるようになっています。


Support aliases to expires_in for cache stores

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

expires_inオプションのaliasとして、expire_inexpired_inを使用出来るよう修正しています。

expires_inは間違いやすい、かつ、間違えた場合にエラーにならず動作してしまい、間違いに気付きにくい為、間違えのケースとして多いと思われる、expire_inexpired_inも使用出来るようにしています。


Merge pull request #39575 from jonathanhefner/clarify-null_store-behavior

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

ActiveSupport::Cache::NullStoreについての説明について、言い回しを修正しています。


Support selenium-webdriver 4 Gemfileactionpack/lib/action_dispatch/system_testing/browser.rbの修正です。

selenium-webdriver 4系のサポートとして、browser optionsの指定方法を修正、及び、Railsのテストでselenium-webdriver 4系を使用するよう修正しています。


Make sure the :if options of callbacks is not mutated

Active Model、Active Recordの修正です。

callbacksのifオプションに指定した値自身を変更しないよう修正しています。with_optionsのようなoptionsを使いまわす処理と一緒に使用した際にエラーになるのを避ける為。


Merge pull request #40960 from abhaynikam/40956-route-table-dark-mode

actionpack/lib/action_dispatch/middleware/templates/routes/_table.html.erbの修正です。

routes table用のCSSにdark mode用のスタイルを追加しています。


Move set_options_for_callback into Callbacks::ClassMethods

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

Make sure the :if options of callbacks is not mutated で変更したset_options_for_callbackメソッドの定義箇所が誤っていたのを修正しています。


add stats method on RedisCacheStore similar to MemCacheStore

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

redis serverの状態を取得する為のRedisCacheStore#statsメソッドを追加しています。実装はredis#infoを呼び出しているだけ。


add locale argument to ActiveModel::Name initialize

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

ActiveModel::Name#initializeの引数にlocaleを追加しています。指定されたlocaleは、initialize内部でActiveSupport::Inflector.pluralizeを実行する際に使用されるようになっています。


Tweak CHANGELOGs [ci skip]

CHANGELOGの修正です。

フォーマットの修正や、不要なスペースの削除を行っています。