Sha256: 15861d1929eeee9283050d9a338aef4c07b5980e3bb5455311f87427c3e93585
Contents?: true
Size: 800 Bytes
Versions: 1
Compression:
Stored size: 800 Bytes
Contents
class Document < ActiveRecord::Base has_attached_file :file, :url => '/:class/:id.:extension', :path => ':rails_root/documents/:class/:id_partition/:style.:extension' validates_attachment_presence :file class << self def new(*args) if !(self.name == "Document") return super end doc = super if(doc.file_content_type.nil?) return doc end if !(doc.file_content_type =~ /^image.*/).nil? return Picture.new *args end if !(doc.file_content_type =~ /^audio.*/).nil? return Audio.new *args end if !(doc.file_content_type =~ /^video.*/).nil? return Video.new *args end return doc end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
social_stream-documents-0.1.0 | app/models/document.rb |