Sha256: 1e5885f04a08dbd5e23de1a106f06fa62127b42efe1229191e4ee3f51747cfbf
Contents?: true
Size: 758 Bytes
Versions: 1
Compression:
Stored size: 758 Bytes
Contents
# frozen_string_literal: true module Paperweight # The location of the attachment in terms of paths are URLs. class Location attr_reader :model, :style def initialize(model, style = :original) @model = model @style = style end def path "#{table_name}/#{model.id}-#{style}-#{model.image_uuid}" end def url "#{self.class.prefix}/#{path}" end def default_url "#{self.class.prefix}/#{table_name}/#{style}.png" end def self.prefix @prefix ||= if Rails.env.production? Paperweight.config.asset_server else 'http://localhost:3000/paperweight' end end private def table_name model.class.table_name end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
paperweight-0.0.5 | lib/paperweight/location.rb |