Sha256: 0fc6d75108d02101947f9823ebf4d1d86a7d0953b86674208b560dcf795f1e8f
Contents?: true
Size: 692 Bytes
Versions: 49
Compression:
Stored size: 692 Bytes
Contents
module Cmor module Testimonials class Category < ActiveRecord::Base has_many :testimonials, -> { order(position: :asc) }, dependent: :destroy do def published merge(Testimonial.published) end end scope :with, ->(type) { joins(type) } scope :with_published_testimonials, -> { with(:testimonials).merge(Testimonial.published) } validates :locale, presence: true, inclusion: { in: I18n.available_locales.map(&:to_s) } validates :identifier, presence: true, uniqueness: { scope: [ :locale ] } validates :name, presence: true, uniqueness: { scope: [ :locale ] } def human name end end end end
Version data entries
49 entries across 49 versions & 1 rubygems