Sha256: 05dbd1022832b1be564394b6ac56b5dc566076c4b50c0852d99557e453e4864a
Contents?: true
Size: 761 Bytes
Versions: 1
Compression:
Stored size: 761 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}/assets/#{table_name}/#{style}.gif" end def self.prefix @prefix ||= if Rails.env.production? Paperweight.config.asset_server else 'http://localhost:3000/uploads' 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.1 | lib/paperweight/location.rb |