diff options
author | Kasper Timm Hansen <kaspth@gmail.com> | 2018-03-03 21:36:43 +0100 |
---|---|---|
committer | Kasper Timm Hansen <kaspth@gmail.com> | 2018-03-03 21:36:43 +0100 |
commit | 0f302b897022b68793e102efa90a2819ff4e107a (patch) | |
tree | 8db635773878ae88556162cc34ecc244c83cb7b8 /activestorage/config | |
parent | 6932998fc7aecba6ade04f8d799f07b494dd402c (diff) | |
download | rails-0f302b897022b68793e102efa90a2819ff4e107a.tar.gz rails-0f302b897022b68793e102efa90a2819ff4e107a.tar.bz2 rails-0f302b897022b68793e102efa90a2819ff4e107a.zip |
Merge Previews/Variants controller into one Representations controller.
Since ActiveStorage::Blob::Representable unifies the idea of previews and
variants under one roof as representation, we may as well have the
controllers follow suit.
Thus ActiveStorage::RepresenationsController enters the fray. I've copied
the old tests for both previews and variants and unified those as well.
Diffstat (limited to 'activestorage/config')
-rw-r--r-- | activestorage/config/routes.rb | 28 |
1 files changed, 8 insertions, 20 deletions
diff --git a/activestorage/config/routes.rb b/activestorage/config/routes.rb index 3f4129d915..20d19f334a 100644 --- a/activestorage/config/routes.rb +++ b/activestorage/config/routes.rb @@ -11,30 +11,18 @@ Rails.application.routes.draw do resolve("ActiveStorage::Attachment") { |attachment, options| route_for(:rails_blob, attachment.blob, options) } - get "/rails/active_storage/variants/:signed_blob_id/:variation_key/*filename" => "active_storage/variants#show", as: :rails_blob_variation + get "/rails/active_storage/representations/:signed_blob_id/:variation_key/*filename" => "active_storage/representations#show", as: :rails_blob_representation - direct :rails_variant do |variant, options| - signed_blob_id = variant.blob.signed_id - variation_key = variant.variation.key - filename = variant.blob.filename + direct :rails_representation do |representation, options| + signed_blob_id = representation.blob.signed_id + variation_key = representation.variation.key + filename = representation.blob.filename - route_for(:rails_blob_variation, signed_blob_id, variation_key, filename, options) + route_for(:rails_blob_representation, signed_blob_id, variation_key, filename, options) end - resolve("ActiveStorage::Variant") { |variant, options| route_for(:rails_variant, variant, options) } - - - get "/rails/active_storage/previews/:signed_blob_id/:variation_key/*filename" => "active_storage/previews#show", as: :rails_blob_preview - - direct :rails_preview do |preview, options| - signed_blob_id = preview.blob.signed_id - variation_key = preview.variation.key - filename = preview.blob.filename - - route_for(:rails_blob_preview, signed_blob_id, variation_key, filename, options) - end - - resolve("ActiveStorage::Preview") { |preview, options| route_for(:rails_preview, preview, options) } + resolve("ActiveStorage::Variant") { |variant, options| route_for(:rails_representation, variant, options) } + resolve("ActiveStorage::Preview") { |preview, options| route_for(:rails_representation, preview, options) } get "/rails/active_storage/disk/:encoded_key/*filename" => "active_storage/disk#show", as: :rails_disk_service |