Sha256: f74e06ea495bf84c67f645bd8873b69f893a219d39cec250fbe0165b09bebe22
Contents?: true
Size: 1.11 KB
Versions: 3
Compression:
Stored size: 1.11 KB
Contents
class TbCommerce::Image < ActiveRecord::Base self.table_name = 'tb_commerce_images' has_many :image_links, :foreign_key => :tb_commerce_image_id accepts_nested_attributes_for :image_links has_attached_file :image, :styles => lambda { |attachment| attachment.instance.dynamic_styles }, :convert_options => TbCommerce.config.image_convert_options, :source_file_options => TbCommerce.config.image_file_options, :storage => TbCommerce.config.paperclip_storage, :url => TbCommerce.config.image_storage_url, :path => TbCommerce.config.image_storage_path validates_attachment_presence :image validates_attachment_content_type :image, content_type: /\Aimage\/.*\Z/ def dynamic_styles admin_styles = { :tb_commerce_small => {:geometry => '125x125#', :format => :jpg, :image_file_options => '-density 72', :image_convert_options => '-strip -quality 85'}, :tb_commerce_medium => {:geometry => '220x220', :format => :jpg, :image_file_options => '-density 72', :image_convert_options => '-strip -quality 85'} } return admin_styles.merge(TbCommerce.config.image_sizes) end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
tb_commerce-0.0.4 | app/models/tb_commerce/image.rb |
tb_commerce-0.0.3 | app/models/tb_commerce/image.rb |
tb_commerce-0.0.2 | app/models/tb_commerce/image.rb |