Sha256: b1e67d0a90387480d10cb898d8eb7599df91769a15188bb8a41155d0d65cb951

Contents?: true

Size: 568 Bytes

Versions: 3

Compression:

Stored size: 568 Bytes

Contents

class Photo < ActiveRecord::Base
  include Positionable
  default_scope order(:position)

  validates :image, :attachment_presence => true,
    :attachment_size => { :in => 0..5.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

3 entries across 3 versions & 1 rubygems

Version Path
fullstack-cms-0.4.6 app/models/photo.rb
fullstack-cms-0.4.5 app/models/photo.rb
fullstack-cms-0.4.4 app/models/photo.rb