aboutsummaryrefslogtreecommitdiffstats
path: root/activestorage/app/models/active_storage/variant.rb
diff options
context:
space:
mode:
authorGeorge Claghorn <george.claghorn@gmail.com>2017-10-12 11:47:21 -0400
committerGitHub <noreply@github.com>2017-10-12 11:47:21 -0400
commit445c682a8465b1a42f1335ae2cf7d20b9a112fcd (patch)
treee86aac9a6dfba21a78b7ce1901a95adc7b42a9ab /activestorage/app/models/active_storage/variant.rb
parent8bcb4fab366611d3e9b34690682415281440c128 (diff)
downloadrails-445c682a8465b1a42f1335ae2cf7d20b9a112fcd.tar.gz
rails-445c682a8465b1a42f1335ae2cf7d20b9a112fcd.tar.bz2
rails-445c682a8465b1a42f1335ae2cf7d20b9a112fcd.zip
Introduce ActiveStorage::Blob#representation
Diffstat (limited to 'activestorage/app/models/active_storage/variant.rb')
-rw-r--r--activestorage/app/models/active_storage/variant.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/activestorage/app/models/active_storage/variant.rb b/activestorage/app/models/active_storage/variant.rb
index 90a3605331..915b78162c 100644
--- a/activestorage/app/models/active_storage/variant.rb
+++ b/activestorage/app/models/active_storage/variant.rb
@@ -65,6 +65,10 @@ class ActiveStorage::Variant
service.url key, expires_in: expires_in, disposition: disposition, filename: blob.filename, content_type: blob.content_type
end
+ # Returns the receiving variant. Allows ActiveStorage::Variant and ActiveStorage::Preview instances to be duck-typed.
+ def image
+ self
+ end
private
def processed?