2019/04/03分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
- Add
after_save_commit
callback as shortcut forafter_commit :hook, on: [ :create, :update ]
. - Add
rails db:prepare
to migrate or setup a database.
Merge pull request #35768 from robertomiranda/r/rake-db-prepare
activerecord/lib/active_record/railties/databases.rake
の修正です。
DBが無ければsetup
を、DBがあればmigrate
を実行するdb:prepare
taskを追加しています。
bin/update
とbin/setup
を1つにまとめる予定(Factorize bin/update in bin/setup, and make bin/setup idempotent)があり、その処理で使用する予定。
Simplify ActionCable.createWebSocketURL and realphabetize exports (#35810)
Action Cableの修正です。
ActionCable.createWebSocketURL
に関する処理のリファクタリングとして、不要な変数を削除、exportの値をアルファベット順について修正等を行っています。
Merge pull request #35771 from timoschilling/hash-speed-improvements
activesupport/lib/active_support/core_ext/hash/except.rb
、
activesupport/lib/active_support/hash_with_indifferent_access.rb
の修正です。
Hash#except
及び、HashWithIndifferentAccess
の#except
、#values_at
、#fetch_values
でRubyネイティブのメソッドを使うようリファクタリングにしています。処理高速化の為。
Merge pull request #35805 from excid3/attachments-field-generators
railtiesの修正です。
generatorにattachment
、attachments
fieldを指定出来るようにしています。Active Storageの設定用のfieldで、指定するとmodelへのhas_one_attached
、又は、has_many_attached
の追加、formへのfield_filed
等の追加を行うようになっています。
Merge pull request #24405 from waits/shallow-false
actionpack/lib/action_dispatch/routing/mapper.rb
の修正です。
resourceがネストしている、かつ、親のresourceでshallw
にfalseを指定していた場合、子のresourceも強制的にshallow
がfalseになっていたのを子のresourceでshallow
オプションを指定出来るようにしています。
resources :blogs, shallow: true do resources :posts do resources :comments, shallow: false end end
というrouteがあった場合、次のように生成されるURLが変更になっています。
# before /posts/1/comments /comments/2 # after /posts/1/comments /posts/1/comments/2
activerecord/lib/active_record/transactions.rb
の修正です。
commit後に処理を行うためのafter_save_commit
callbackを追加しています。after_commit :hook, on: [ :create, :update ]
のショートカット版。
actionpack/test/dispatch/routing_test.rb
、
railties/test/application/zeitwerk_integration_test.rb
の修正です。
rubocopの設定に違反している箇所があったのを修正しています。
Fixed description of the cache_key_with_version
method [ci skip]
rails guideのCaching with Rails: An Overview
の修正です。
cache_key_with_version
メソッドの説明がid
とupdated_at
attributeをベースに作成される、となっていたのを、modelのclass nameも使用される旨説明を追加しています。
Remove duplicated CHANGELOG entry [ci skip]
activerecord/CHANGELOG.md
の修正です。
重複してあったCHANGELOGのエントリーを削除しています。
Fix the markup for insert_all
and upsert_all
docs [ci skip]
activerecord/lib/active_record/persistence.rb
のdocの修正です。
insert_all
、upsert_all
メソッドのdocのフォーマットの修正を行っています。
Use official database name [ci skip]
docの修正です。
各箇所のDB名を正式名称(e.g. Postgres
-> PostgreSQL
)に修正しています。
Don't assign to @changed_attributes
in becomes
activerecord/lib/active_record/persistence.rb
の修正です。
becomes
メソッドで使用していない@changed_attributes
に値を設定していたのを、値を設定しないよう修正しています。
[ci skip] Doc for shallow: false options should use for better readability. PR after #24405
actionpack/lib/action_dispatch/routing/mapper.rb
のdocの修正です。
resources
メソッドのdoc内のフォーマットの修正を行っています。
bytes_margin
is only needed when previous_packet
exists
activerecord/lib/active_record/connection_adapters/mysql/database_statements.rb
の修正です。
fixtures処理用のSQLのpacket sizeをチェックする際に、max_allowed_packet
の値に対してbyte marginを加えていたのを、前のpacketに対して加えるよう修正しています。marginは前のpacketがある場合のみ考慮が必要な為。
Don't normalize original_app_name
railties/lib/rails/generators/app_name.rb
の修正です。
rails new
の引数のアプリ名に不正な名前が指定された場合に表示するエラーメッセージで、アプリ名が加工された状態で表示されていたのを、ユーザが指定した値がそのまま表示されるよう修正してます。
Add rake db:prepare entry to the CHANGELOG.md
activerecord/CHANGELOG.md
の修正です。
先のdb:prepare
taskを追加した対応についてCHANGELOGにエントリーを追加しています。
[ci skip] Touch up db:prepare
changelog entry
activerecord/CHANGELOG.md
の修正です。
db:prepare
taskのエントリーの説明を修正しています。
Add test that the listen gem is included when RUBY_ENGINE is not 'ruby'
railties/test/generators/app_generator_test.rb
の修正です。
listen
gemがCRuby以外の環境でもGemfileに記載される事を確認するテストを追加しています。