Sha256: cc1283e6f2880a567274f0ab72ff56daafd777b18ee133aed99c21f7f8caafee

Contents?: true

Size: 586 Bytes

Versions: 18

Compression:

Stored size: 586 Bytes

Contents

class Photo < ActiveRecord::Base

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

  has_attached :image, :styles => {
    :large  =>  ["800x600", :jpeg],
    :thumb  =>  ["100x100", :jpeg]
  }
  
  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

18 entries across 18 versions & 1 rubygems

Version Path
fullstack-cms-0.2.31 app/models/photo.rb
fullstack-cms-0.2.30 app/models/photo.rb
fullstack-cms-0.2.29 app/models/photo.rb
fullstack-cms-0.2.28 app/models/photo.rb
fullstack-cms-0.2.27 app/models/photo.rb
fullstack-cms-0.2.26 app/models/photo.rb
fullstack-cms-0.2.25 app/models/photo.rb
fullstack-cms-0.2.24 app/models/photo.rb
fullstack-cms-0.2.23 app/models/photo.rb
fullstack-cms-0.2.22 app/models/photo.rb
fullstack-cms-0.2.21 app/models/photo.rb
fullstack-cms-0.2.20 app/models/photo.rb
fullstack-cms-0.2.19 app/models/photo.rb
fullstack-cms-0.2.18 app/models/photo.rb
fullstack-cms-0.2.17 app/models/photo.rb
fullstack-cms-0.2.16 app/models/photo.rb
fullstack-cms-0.2.15 app/models/photo.rb
fullstack-cms-0.2.14 app/models/photo.rb