Sha256: 81c9317a22159deebeb900c718ea619ff3bed867253af6f74965d52c05fdc97e
Contents?: true
Size: 684 Bytes
Versions: 7
Compression:
Stored size: 684 Bytes
Contents
module Spina class Photo < ActiveRecord::Base mount_uploader :file, PhotoUploader has_many :page_parts, as: :page_partable has_many :structure_parts, as: :structure_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 def self.order_by_ids(ids) sql = sanitize_sql_for_conditions({id: ids}) order("CASE WHEN #{sql} THEN 0 ELSE 1 END") end end end
Version data entries
7 entries across 7 versions & 1 rubygems