Sha256: 40761e0620b80e4733b1d1257aa3af0b1e1f838d92e014239a65e11abc764fe5
Contents?: true
Size: 1.28 KB
Versions: 27
Compression:
Stored size: 1.28 KB
Contents
module Apidae class AttachedFile < ActiveRecord::Base belongs_to :apidae_object, :class_name => 'Apidae::Object' has_attached_file :picture, { :styles => { :xlarge => ['1600x1200>', :jpg], :large => ['1280x960>', :jpg], :medium => ['800x600>', :jpg], :small => ['320x240', :jpg], :thumb => ['200x200>', :png] }, :default_url => "/#{Rails.application.config.apidae_pictures_path}/default/logo.png", :path => "public/#{Rails.application.config.apidae_pictures_path}/:apidae_type/:apidae_id/:basename.:extension", :url => "/#{Rails.application.config.apidae_pictures_path}/:apidae_type/:apidae_id/:basename.:extension" } validates_attachment :picture, content_type: { content_type: /\Aimage\/.*\Z/ } private Paperclip.interpolates :apidae_type do |attachment, style| attachment.instance.apidae_object.apidae_type.downcase end Paperclip.interpolates :apidae_id do |attachment, style| attachment.instance.apidae_object.apidae_id end end end
Version data entries
27 entries across 27 versions & 2 rubygems