diff options
author | George Claghorn <george.claghorn@gmail.com> | 2017-09-28 16:43:37 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-09-28 16:43:37 -0400 |
commit | d30586211b41e018869a1a3f4e3af778a31591db (patch) | |
tree | 664028edf779b3a6d55e08c2503cfe91e2309eff /activestorage/app/models/active_storage/variant.rb | |
parent | f7b4be40410432b77e0c5d114b0ce73480ff984d (diff) | |
download | rails-d30586211b41e018869a1a3f4e3af778a31591db.tar.gz rails-d30586211b41e018869a1a3f4e3af778a31591db.tar.bz2 rails-d30586211b41e018869a1a3f4e3af778a31591db.zip |
Preview PDFs and videos
Diffstat (limited to 'activestorage/app/models/active_storage/variant.rb')
-rw-r--r-- | activestorage/app/models/active_storage/variant.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/activestorage/app/models/active_storage/variant.rb b/activestorage/app/models/active_storage/variant.rb index 02bf32b352..54685b4c0e 100644 --- a/activestorage/app/models/active_storage/variant.rb +++ b/activestorage/app/models/active_storage/variant.rb @@ -38,8 +38,8 @@ class ActiveStorage::Variant attr_reader :blob, :variation delegate :service, to: :blob - def initialize(blob, variation) - @blob, @variation = blob, variation + def initialize(blob, variation_or_variation_key) + @blob, @variation = blob, ActiveStorage::Variation.wrap(variation_or_variation_key) end # Returns the variant instance itself after it's been processed or an existing processing has been found on the service. @@ -61,7 +61,7 @@ class ActiveStorage::Variant # Use <tt>url_for(variant)</tt> (or the implied form, like +link_to variant+ or +redirect_to variant+) to get the stable URL # for a variant that points to the ActiveStorage::VariantsController, which in turn will use this +service_call+ method # for its redirection. - def service_url(expires_in: 5.minutes, disposition: :inline) + def service_url(expires_in: service.url_expires_in, disposition: :inline) service.url key, expires_in: expires_in, disposition: disposition, filename: blob.filename, content_type: blob.content_type end |