Sha256: 499b73a89b4de63d7242e6e9853ab37fe214b5ee82928190ab8226a383a6adb8

Contents?: true

Size: 518 Bytes

Versions: 2

Compression:

Stored size: 518 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]
  }

  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

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fullstack-cms-0.1.7 app/models/photo.rb
fullstack-cms-0.1.6 app/models/photo.rb