なるようになるブログ

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

rails commit log流し読み(2018/06/24)

2018/06/24分のコミットです。

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


Update raabro to latest version

Gemfile.lockの修正です。

raabroのバージョンを最新のバージョンに更新しています。


Fix formatting of primary_key [ci skip]

activerecord/lib/active_record/connection_adapters/postgresql/schema_definitions.rbのdocの修正です。

primary_keyメソッドのdocのフォーマットを修正しています。


Update service.rb

activestorage/lib/active_storage/service.rbのdocの修正です。

ActiveStorage::Service#urlメソッドのdocのグラマーの修正を行っています。


Add an assertion that credentials:edit works when RAILS_MASTER_KEY env is specified

railties/test/commands/credentials_test.rbの修正です。

config/master.keyがない、かつ、RAILS_MASTER_KEY envが指定されている場合に、credentials:editコマンドが正しく動作することを確認するassertを追加しています。

rails commit log流し読み(2018/06/23)

2018/06/23分のコミットです。

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


Active Storage: Explicit form field in basic example

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

has_one_attachedの項、attachmentを更新するexampleコードについて説明している箇所に、viewのコードも追加しています。


OS X -> macOS [Closes #30313]

各ドキュメント内で、OS Xになっていた箇所をまとめてmacOSに修正しています。

rails commit log流し読み(2018/06/22)

2018/06/22分のコミットです。

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


Permit configuring the default service URL expiry

Active Storageの修正です。

Active Storageが生成するファイルアクセス用のURLの有効期限が5分固定になっていたのを、configで有効期限を指定出来るよう修正しています。

値はconfig.active_storage.service_urls_expire_inで指定出来るようになっています。


Add missing test case for find with a large number

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

findメソッドに巨大な数字を指定した場合のテストを追加しています。


Add to docs mention about :year_format option of date select

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

date_selectメソッドのdocに:year_formatオプションについての説明を追加しています。

rails commit log流し読み(2018/06/21)

2018/06/21分のコミットです。

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

actionview/CHANGELOG.md


add documentation for config.active_support.use_authenticated_message_encryption [ci skip]

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

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


Merge pull request #33175 from gsamokovarov/fix-actionpack-typo

actionpack/CHANGELOG.mdの修正です。

implicitimplictにタイポしている箇所があったのを修正しています。


Merge pull request #32190 from liwii/use_year_names

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

date_selectメソッドにyearの値をカスタマイズする為のyear_formatオプションを追加しています。

例。

date_select('user_birthday', '', start_year: 1998, end_year: 2000, year_format: -> year { "Heisei #{year - 1988}" })
<select id="user_birthday__1i" name="user_birthday[(1i)]">
<option value="1998">Heisei 10</option>
<option value="1999">Heisei 11</option>
<option value="2000">Heisei 12</option>
</select>

Update fugit to latest version

Gemfile.lockの修正です。

fugitのバージョンを最新のバージョンに更新しています。Rubyのwarningが表示されるのを避ける為。

rails commit log流し読み(2018/06/20)

2018/06/20分のコミットです。

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


Merge pull request #33074 from lsylvester/optimize-pluck

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

ActiveRecord::Result#cast_valuesで不要な一時配列を作成しないようリファクタリングしています。

ActiveRecord::Result#cast_valuesActiveRecord::Relation#pluckから呼び出される処理の為、このリファクタリングによりActiveRecord::Relation#pluck実行時に生成されるオブジェクト数が多少減少しています。


Convert hashes into parameters (#33076)

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

ActionController::Parameters#transform_values、及び、#transform_values!メソッドでblockに渡される値がHashだったのを、ActionController::Parametersに修正しています(HashActionController::Parametersに変換してから渡すようになっています)。


Remove unused rs argument from JoinDependency#construct

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

JoinDependency#constructの引数から使用していないrsを削除しています。


Remove useless aliases argument from JoinDependency#construct

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

JoinDependency#constructの引数から使用していないaliasesを削除しています。


Remove all aliases passing from JoinDependency

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

JoinDependency#construct_modelの引数から使用していないaliasesを削除しています。

rails commit log流し読み(2018/06/19)

2018/06/19分のコミットです。

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


Add test case for the | token in Journey scanner

actionpack/test/journey/route/definition/scanner_test.rbの修正です。

Journey scannerで| tokenを指定した場合のテストを追加しています。


Fix Ruby version in .ruby-version

railties/lib/rails/generators/rails/app/templates/ruby-version.ttの修正です。

ruby-versionRubyのバージョンを指定する際に、ENV["RBENV_VERSION"]、及び、ENV["rvm_ruby_string"]の値を参照するよう修正しています。

-<%= "#{RUBY_ENGINE}-#{RUBY_ENGINE_VERSION}" -%>
+<%= ENV["RBENV_VERSION"] || ENV["rvm_ruby_string"] || "#{RUBY_ENGINE}-#{RUBY_ENGINE_VERSION}" -%>

"#{RUBY_ENGINE}-#{RUBY_ENGINE_VERSION}"だと、stable version以外のversion(2.5.0.rc1jruby-9.2.0.0-SNAPSHOT)と一致しない為。


Removed useless utility classes inside HABTM association builder

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

HasAndBelongsToMany associationのbuild処理で、build処理用のユーティリティクラスを削除するようリファクタリングしています。


Merge pull request #33134 from dasch/dasch/extra-cache-controls

actionpack/lib/action_controller/metal/conditional_get.rbactionpack/lib/action_dispatch/http/cache.rbの修正です。

expires_inメソッドに、stale-while-revalidate、及び、stale-if-error Extensionのサポートを追加しています。

オプションにstale_while_revalidatestale_if_errorオプションが指定出来るようになっており、指定した値がそのままCache-Control ヘッダーに含まれるようになっています。

参考:RFC 5861 - HTTP Cache-Control Extensions for Stale Content


Ensure to calculate column aliases after all table aliases are constructed

Active Recordの修正です。

すべてのtable aliases の構築が終わった後にcolumn aliasesの生成を行うよう修正しています。

元々は、FROM句ですべてのtable aliasesの作成する前に、eager loadingに使用されるcolumn aliasesの生成が行われていました。

ただそれだと、joinとeager loadingの両方に同じテーブルのassociatonが指定された場合に、column aliasesとtable aliasesでaliasの値が一致しなくなるケースが発生してしまっていました。

で、その問題に対応する為、column aliasesの生成をすべてのtable aliasesの構築後に行うようにしています。

rails commit log流し読み(2018/06/18)

2018/06/18分のコミットです。

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

activerecord/CHANGELOG.md


Remove unused require

railties/lib/rails/commands/server/server_command.rbの修正です。

使用していないrequireを削除しています。


Add docs for ActiveRecord::Migration#say, #say_with_time, #suppress_messages [ci skip]

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

ActiveRecord::Migration#say#say_with_timesuppress_messagesメソッドにdocを追加しています。


Fix touch option to behave consistently with Persistence#touch method

Active Recordの修正中です。

increment!update_countersメソッドで、touchオプションにattribute namesを指定した場合に、その指定されたattributes namesだけ更新されて、update_at/onは更新されていなかったのを、update_at/on も更新する(指定されたattributes names + update_at/on が更新される)ように修正しています。

Persistence#touchと挙動を合わせる為。