Sha256: d8a9762baa6a9af4a54fe05e0ceefe3f87a65d0c45d7b6cc39e1daf2d9b99e9a
Contents?: true
Size: 905 Bytes
Versions: 2
Compression:
Stored size: 905 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, :rotator] 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.10 | app/models/photo.rb |
fullstack-cms-0.3.9 | app/models/photo.rb |