Sha256: f4ec6fda448add73ba8817c56456284e17a9eac23bd6a24c72e1b40a90d2ac67
Contents?: true
Size: 907 Bytes
Versions: 2
Compression:
Stored size: 907 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, :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
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fullstack-cms-0.3.30 | app/models/photo.rb |
fullstack-cms-0.3.29 | app/models/photo.rb |