Sha256: f99b2c5668904cc31d30bbae62f695ced1152dc2b0081cf173edda30198ff26f
Contents?: true
Size: 907 Bytes
Versions: 18
Compression:
Stored size: 907 Bytes
Contents
class Photo < ActiveRecord::Base include Positionable default_scope order(:position) validates_attachment :image, :presence => true, :size => { :in => 0..2.megabytes } has_attached :image, :processors => [:auto_orient, :thumbnail] 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 # ============ # = Rotation = # ============ attr_accessor :rotation_degrees, :rotate def rotate!(degrees = 90) self.rotation_degrees ||= degrees self.rotate = true self.image.reprocess! self.save end def rotating? !self.rotation_degrees.nil? and self.rotate end end
Version data entries
18 entries across 18 versions & 1 rubygems