Sha256: ec59a1fcc906823e2704196335674347a3dbe0efbbb55c8790ce3a4c8dd62ace

Contents?: true

Size: 906 Bytes

Versions: 1

Compression:

Stored size: 906 Bytes

Contents

class Slide < ActiveRecord::Base
  acts_as_publishable
  acts_as_list :scope => :slide_show_id
  has_attachment :storage => :file_system, #Should be changed to S3 for production
                 :path_prefix => 'public/assets/slides', #Should be changed to S3 for production
                 :max_size => 5.megabytes,
                 :content_type => :image
                   
  validates_presence_of :size, :content_type, :if => :has_file?
  validate              :attachment_attributes_valid?, :if => :has_file?
  belongs_to :slide_show

  attr_accessible :slide_show_id, :title, :date, :link, :strapline, :publish, :hide, :uploaded_data, :body

  default_scope :order => 'position ASC'

  def to_json(options = {})
    options.reverse_merge! :methods => :public_filename, :only => [:title, :strapline, :link, :date]
    super options
  end

private
  def has_file?
    filename != 'no_file'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
beef-slides-1.1.5 app/models/slide.rb