Sha256: 3d65ba1c8952c1d1cc427bd16690e659e14f91d28815d908e2e6a2c0d652d8c7
Contents?: true
Size: 776 Bytes
Versions: 146
Compression:
Stored size: 776 Bytes
Contents
module Types::Objects::Base class AttachmentType < Types::BaseObject field :id, Int, nil, null: false field :filename, String, nil, null: false field :url, String, nil, null: false def id if object.class.eql?(ActiveStorage::Variant) object.blob.id else object.id end end def filename if object.class.eql?(ActiveStorage::Variant) object.blob.filename.to_s + "-" + object.variation.transformations[:resize] else object.filename.to_s end end def url if object.class.eql?(ActiveStorage::Variant) Rails.application.routes.url_helpers.rails_representation_url(object) else object.service_url end end end end
Version data entries
146 entries across 146 versions & 2 rubygems