Sha256: a73a60deba4e76b6c569b5542df751c575f76625dd2cfed8883dbb7c35881dea

Contents?: true

Size: 914 Bytes

Versions: 4

Compression:

Stored size: 914 Bytes

Contents

class ExportFile < ActiveRecord::Base
  attr_accessible :export_content_type, :export_file_name, :export_file_size, :state

  belongs_to :user
  validates_associated :user_id

  if Setting.uploaded_file.storage == :s3
    has_attached_file :export, :storage => :s3, :s3_credentials => "#{Rails.root.to_s}/config/s3.yml",
      :s3_permissions => :private
  else
    has_attached_file :export,
      :path => ":rails_root/private/system/:class/:attachment/:id_partition/:style/:filename"
  end
  validates_attachment_content_type :export, :content_type => ['text/csv', 'text/plain', 'text/tab-separated-values', 'application/octet-stream']

  state_machine :initial => :pending do
    event :sm_start do
      transition [:pending, :started] => :started
    end

    event :sm_complete do
      transition :started => :completed
    end

    event :sm_fail do
      transition :started => :failed
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
enju_export-0.1.1.pre4 app/models/export_file.rb
enju_export-0.1.1.pre3 app/models/export_file.rb
enju_export-0.1.1.pre2 app/models/export_file.rb
enju_export-0.1.1.pre app/models/export_file.rb