Module: Eluvia::AttachmentHelper
- Extended by:
- ActiveSupport::Concern
- Included in:
- File
- Defined in:
- lib/eluvia/helpers/attachment_helper.rb
Instance Method Summary collapse
Instance Method Details
#attachment_url(attachment, skip_check: false, expires_in: nil) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/eluvia/helpers/attachment_helper.rb', line 5 def (, skip_check: false, expires_in: nil) unless skip_check return nil unless .attached? end if Rails.application.config.active_storage.service == :local Rails.application.routes.url_helpers.rails_blob_path(, only_path: true) elsif expires_in .url(expires_in: expires_in) else .url end # NOTE: class method can't be called from instance method because of controller / view helpers, so we need to # duplicate the code here. end |