なるようになるブログ

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

rails commit log流し読み(2017/08/22)

2017/08/22分のコミットです。

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

activerecord/CHANGELOG.md


Fix broken link to mysql docs in database.yml [ci skip]

railties/lib/rails/generators/rails/app/templates/config/databases/jdbcmysql.ymlrailties/lib/rails/generators/rails/app/templates/config/databases/mysql.ymlのdocの修正です。

password hashingについてのリンク(https://dev.mysql.com/doc/refman/5.7/en/password-hashing.html)が古いリンク先になっていたのを修正しています。


[ci skip] form_with in the getting started guide.

actionview/lib/action_view/helpers/form_helper.rbのdoc、及び、Rails guideのGetting Started with Railsの修正です。

guideでform_forを使用していた箇所をform_withを使用するよう修正、及び、form_withのdoc内:modelオプションを指定した場合の挙動についての詳細な説明を追加しています。


Update debugging_rails_applications [ci skip]

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

byebugによるデバッグのexampleコードのインデントがずれていたのを修正しています。


Encode Content-Disposition filenames according to RFC 2231

Active Storageの修正です。

Content-Disposition filenameをencodeするよう修正しています。encodeのルールはRFC 2231に準拠しています。

これにより、英語以外のファイル名も適切に扱えるようになています。多分。


Add frozen string literal pragma

activestorage/app/models/active_storage/filename/parameters.rbの修正です。

ファイルの先頭にfrozen_string_literal: trueを追加しています。


Update MIT licenses link [ci skip]

MIT Licenseへのリンクをhttp://www.opensource.org/licenses/MITからhttps://opensource.org/licenses/MITに修正しています。


Update links to use https instead of http [ci skip]

Active Supportのdoc内にある外部ページへのリンクを、httpからhttpsに修正しています。


Update links to use https instead of http [ci skip]

Active Recordのdoc内にある外部ページへのリンクを、httpからhttpsに修正しています。


Merge pull request #30348 from koic/remove_frozen_string_literal_from_templates

各templateファイルからfrozen_string_literal: trueを削除しています。

ライブラリのコードに対してfrozen_string_literalを設定するのはよいが、アプリに対して設定する必要は無いのでは、という指摘がコミッターからあった為のようです。

対応したことによるメリット(性能)より、対応に掛かるコストの方が高いからですかねえ。

参考:Apply frozen_string_literal magic comment to template files


Update links to use https link instead of http [ci skip]

Action Packのdoc内にある外部ページへのリンクを、httpからhttpsに修正しています。


Remove frozen_string_literal comment from activestorage’s migration

.rubocop.ymlactivestorage/db/migrate/20170806125915_create_active_storage_tables.rbの修正です。

Active Storage用のmigrationファイルからfrozen_string_literal: trueを削除しています。

各templateファイルからfrozen_string_literal: trueを削除した、Merge pull request #30348 from koic/remove_frozen_string_literal_from_templatesのフォローアップです。このmigrationファイルもapplication向けファイルな為。


missing backquotes [ci skip]

Rails guideの修正です。

ファイル名、ディレクトリ名のクォートが不足していた箇所があったのを修正しています。


Automatically guess the inverse associations for STI

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

STIに対するinverse associationsが正しく動作していなかったのを修正しています。

コミットより引用。

class Post < ActiveRecord::Base
  belongs_to :author
end

class SpecialPost < Post; end

class Author < ActiveRecord::Base
  has_many :posts
  has_many :special_posts
end

上記のようなクラスがあった場合に、author.special_posts.first.authorが動作していなかったのを、動作するようにしています。


Use 5.2 version of ActiveRecord::Migration for Active Storage

activestorage/db/migrate/20170806125915_create_active_storage_tables.rbactivestorage/test/database/create_users_migration.rbの修正です。

Active Storage用のmigrationファイル、及び、Active Storageがテストで使うmigiationファイルのバージョンを5.2に更新しています。