Sha256: 65123336ef7fe7f25c886ae1ffad129ffc1996d40943617f26e24ce7e9e3a656
Contents?: true
Size: 765 Bytes
Versions: 7
Compression:
Stored size: 765 Bytes
Contents
module Ecm::Videos class Category < ActiveRecord::Base # markup support include Models::MarkupConcern markup :description # acts as published include ActsAsPublished::ActiveRecord acts_as_published has_many :videos, -> { order(position: :asc) } validates :locale, :name, :markup_language, presence: true after_initialize :set_defaults, if: :new_record? def preview_image videos.first.try(:preview_image) end def published_preview_image_url(style) return unless video = videos.published.first video.clip.url(style) end def videos_count videos.count end private def set_defaults self.markup_language = Configuration.default_markup_language end end end
Version data entries
7 entries across 7 versions & 1 rubygems