Sha256: 4f63363c7d82636d89e5bbb113f4a9d42b066c84ba438284a60ee6a7e1d3c8ec

Contents?: true

Size: 497 Bytes

Versions: 1

Compression:

Stored size: 497 Bytes

Contents

class Photo < ActiveRecord::Base

  validates_attachment :image, :presence => true,
    :size => { :in => 0..2.megabytes }

  has_attached :image
  
  acts_as_taggable

  validates_presence_of :photographable
  belongs_to :photographable, :polymorphic => :true
  delegate :url, :file_name, :to => :image
  
  field :caption, :text
  
  def owner
    photographable.owner if photographable && photographable.respond_to?(:owner)
  end
    
  timestamps

  def to_label
    image_file_name
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fullstack-cms-0.2.32.fix app/models/photo.rb