Sha256: 90719b46a81aaf02ce3deee1322df1bd251631fa9e25c52773c62970e2532808

Contents?: true

Size: 488 Bytes

Versions: 3

Compression:

Stored size: 488 Bytes

Contents

module Spina
  class Photo < ActiveRecord::Base
    mount_uploader :file, PhotoUploader

    has_many :page_parts, as: :page_partable
    has_many :photo_collections_photos
    has_many :photo_collections, through: :photo_collections_photos

    scope :sorted, -> { order('created_at DESC') }
    scope :sorted_by_photo_collection, -> { order('position') }

    validates_presence_of :file

    def name
      file.file.filename
    end

    def content
      self
    end
    
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
spina-0.6.13 app/models/spina/photo.rb
spina-0.6.12 app/models/spina/photo.rb
spina-0.6.11 app/models/spina/photo.rb