Sha256: 08443f802595a51bc2c3d6ff75da26251d73c2febd9080f751903405a8da8e5f

Contents?: true

Size: 557 Bytes

Versions: 9

Compression:

Stored size: 557 Bytes

Contents

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

  validates_attachment :image, :presence => true,
    :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

9 entries across 9 versions & 1 rubygems

Version Path
fullstack-cms-0.4.3 app/models/photo.rb
fullstack-cms-0.4.2 app/models/photo.rb
fullstack-cms-0.4.1 app/models/photo.rb
fullstack-cms-0.3.39 app/models/photo.rb
fullstack-cms-0.3.38 app/models/photo.rb
fullstack-cms-0.3.37 app/models/photo.rb
fullstack-cms-0.3.36 app/models/photo.rb
fullstack-cms-0.3.35 app/models/photo.rb
fullstack-cms-0.3.34 app/models/photo.rb