2017/10/23分のコミットです。
CHANGELOGにのったコミットは以下の通りです。
Merge pull request #30821 from GBH/active-storage-readme
activestorage/README.md
の修正です。
Installation
の項を追加し、rails active_storage:install
タスクについての説明を追加しています。
Remove unnedded Active Storage installation stepsで一度削除された内容なんですよねえ。Active Storageの自動インストール対応がまだマージされてないので必要は必要なのですが。
Add changelog entry about new allow_other_host
option for redirect_back
method [ci skip]
actionpack/CHANGELOG.md
の修正です。
redirect_back
メソッドにallow_other_host
オプションを追加した対応(Add allow_other_host option to redirect_back method)についてCHANGELOGにエントリーを追加しています。
Extract metadata from images and videos
Active Storageの修正です。
blobからメタデータを取得する為の仕組みを追加しています。
取得処理はAnalyzer
クラスを使用して行われるようになっており、デフォルトでimageとvideoのメタデータを取得出来るようになっています。
# blobがimageの場合 ActiveStorage::Analyzer::ImageAnalyzer.new(blob).metadata # => { width: 4104, height: 2736 } # blobがvideoの場合 ActiveStorage::VideoAnalyzer.new(blob).metadata # => { width: 640, height: 480, duration: 5.0, angle: 0, aspect_ratio: [4, 3] }
blob保存時にafter_create_commit
callbackでメタデータ取得処理が実行される(メタデータ取得処理はActive Job経由で行われるので、基本的には非同期)ようになっています。また、デフォルトで対応しているフォーマット以外のメタデータを取得したい場合、自分でAnalyzerを作成しそれを使用するようにすれば良いようになっています。
activestorage/lib/active_storage/analyzer/image_analyzer.rb
のdocの修正です。
Analyzer::ImageAnalyzer
クラスのdoc内、リンクのフォーマットが崩れていたのを修正しています。
Place MocktailDesigner
in test/models/drink_designer.rb
Active Recordのテストの修正です。
MocktailDesigner
クラスの定義ファイルをactiverecord/test/models/mocktail_designer.rb
からactiverecord/test/models/drink_designer.rb
に移動しています。
MocktailDesigner
はDrinkDesigner
クラスの子クラスであり、MocktailDesigner
単体で使用する事は無い為、DrinkDesigner
と同じファイルに定義するようにしたとの事です。
Use the indicative mood consistently [ci skip]
activestorage/lib/active_storage/downloading.rb
のdocの修正です。
ActiveStorage::Downloading#download_blob_to_tempfile
メソッドのdocのグラマーの修正を行っています。
Fix #to_json for unreadable IO objects, fixes #26132
activesupport/lib/active_support/core_ext/object/json.rb
の修正です。
IOオブジェクトをJSONに変換出来るよう、IO
クラスにas_json
メソッドを追加しています。メソッドの実装は下記の通り。
class IO def as_json(options = nil) #:nodoc: to_s end end
Ensure associations doesn't table name collide with string joins
activerecord/lib/active_record/associations/alias_tracker.rb
、activerecord/test/cases/associations/inner_join_association_test.rb
の修正です。
associationとjoinにStringで指定したテーブル名(e.g. joins("JOIN people agents_people ON agents_people.primary_contact_id = people.id")
)が衝突しない事を確認するテストを追加しています。
Fix duplicate aliases when using both INNER/LEFT JOINs
activerecord/lib/active_record/relation/query_methods.rb
の修正です。
joins
とleft_outer_joins
に同じassociationを指定した場合に、同じaliasが定義されてしまうバグがあったのを修正しています。
# before User.joins(:posts).left_outer_joins(:posts).count #=> SELECT COUNT(*) FROM "users" INNER JOIN "posts" ON "posts"."user_id" = "users"."id" LEFT OUTER JOIN "posts" ON "posts"."user_id" = "users"."id" # after User.joins(:posts).left_outer_joins(:posts).count #=> SELECT COUNT(*) FROM "users" INNER JOIN "posts" ON "posts"."user_id" = "users"."id" LEFT OUTER JOIN "posts" "posts_users" ON "posts_users"."user_id" = "users"."id"
Remove CHANGELOT entry for the change that was backported to 5-1-stable [ci skip]
activejob/CHANGELOG.md
の修正です。
Rails 5.1にバックポートされている対応のエントリーを削除しています。