Sha256: 02c906c4593043b9e15fd7eabc043871c9fcc8829b4312824e6f42f51bc3dee1

Contents?: true

Size: 897 Bytes

Versions: 5

Compression:

Stored size: 897 Bytes

Contents

module CabooseStore
  class ProductImage < ActiveRecord::Base
    self.table_name = "store_product_images"
    
    belongs_to :product
    has_many :product_image_variants
    has_many :variants, :through => :product_image_variants    
      
    attr_accessible :id, :title  
    has_attached_file :image,
      #:path => "#{Rails.root}/public/products/:product_id_:id_:style.:extension",
      :path => "products/:product_id_:id_:style.:extension",
      :default_url => '/products/:id_:style.:extension',
      :styles => {
        :tiny   => '100x100>',
        :thumb  => '250x250>',
        :medium => '400x400>',
        :large  => '800x800>',
        :huge   => '1200x1200>'
      }  
  
    def url(size) # 'tiny', 'thumb', 'medium', 'large', 'huge'
      self.image.url(size)
    	#"https://s3.amazonaws.com/tuskwear/products/#{self.product_id}_#{self.id}_#{size}.jpg"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
caboose-store-0.0.10 app/models/caboose_store/product_image.rb
caboose-store-0.0.9 app/models/caboose_store/product_image.rb
caboose-store-0.0.8 app/models/caboose_store/product_image.rb
caboose-store-0.0.7 app/models/caboose_store/product_image.rb
caboose-store-0.0.6 app/models/caboose_store/product_image.rb