Sha256: 13905e9da8a17f9e457c2daea7ba7e6839009fd9643cec475c03405d66467dda
Contents?: true
Size: 743 Bytes
Versions: 16
Compression:
Stored size: 743 Bytes
Contents
module Concerns::Album extend ActiveSupport::Concern included do extend Enumerize extend FriendlyId attr_accessible :date, :description, :status, :title enumerize :status, in: [:published, :unpublished], default: :published, predicates: true friendly_id :title, use: :slugged has_many :photos, dependent: :destroy belongs_to :related, :polymorphic => true validation_for_title validation_for_date scope :published, includes(:photos).where(status: :published) scope :desc, order('albums.date DESC') end module ClassMethods def validation_for_title validates_presence_of :title end def validation_for_date validates_presence_of :date end end end
Version data entries
16 entries across 16 versions & 2 rubygems