Sha256: bdfed9a63900ded04e6c5d521d41568c10e68ae70831fee0a557971bfa5a0873

Contents?: true

Size: 777 Bytes

Versions: 19

Compression:

Stored size: 777 Bytes

Contents

require 'uri'

class Caboose::MediaImage < ActiveRecord::Base

  self.table_name = "media_images"
  belongs_to :media_category  
  has_attached_file :image, 
    :path => 'media-images/:id_:style.:extension',
    :default_url => "#{Caboose::cdn_domain}/media-images/default_user_image.jpg",    
    :styles => {
      :tiny  => '150x200>',
      :thumb => '300x400>',
      :large => '600x800>'
    }
  do_not_validate_attachment_file_type :image  
  attr_accessible :id, :media_category_id, :name, :description

  def process
    puts "http://#{Caboose::cdn_domain}/media-images/#{self.id}#{File.extname(self.name.downcase)}"
    self.image = URI.parse("http://#{Caboose::cdn_domain}/media-images/#{self.id}#{File.extname(self.name.downcase)}")
    self.save    
  end
  
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
caboose-cms-0.4.71 app/models/caboose/media_image.rb
caboose-cms-0.4.70 app/models/caboose/media_image.rb
caboose-cms-0.4.69 app/models/caboose/media_image.rb
caboose-cms-0.4.68 app/models/caboose/media_image.rb
caboose-cms-0.4.67 app/models/caboose/media_image.rb
caboose-cms-0.4.66 app/models/caboose/media_image.rb
caboose-cms-0.4.65 app/models/caboose/media_image.rb
caboose-cms-0.4.64 app/models/caboose/media_image.rb
caboose-cms-0.4.63 app/models/caboose/media_image.rb
caboose-cms-0.4.62 app/models/caboose/media_image.rb
caboose-cms-0.4.61 app/models/caboose/media_image.rb
caboose-cms-0.4.60 app/models/caboose/media_image.rb
caboose-cms-0.4.59 app/models/caboose/media_image.rb
caboose-cms-0.4.58 app/models/caboose/media_image.rb
caboose-cms-0.4.57 app/models/caboose/media_image.rb
caboose-cms-0.4.56 app/models/caboose/media_image.rb
caboose-cms-0.4.55 app/models/caboose/media_image.rb
caboose-cms-0.4.54 app/models/caboose/media_image.rb
caboose-cms-0.4.53 app/models/caboose/media_image.rb