Sha256: 312a34aa45388ca9f5adf6f719f404a248d11fa62c8ac3c00f06017428dc8016
Contents?: true
Size: 903 Bytes
Versions: 7
Compression:
Stored size: 903 Bytes
Contents
module Georgia class Widget < ActiveRecord::Base include Concerns::Contentable has_many :ui_associations, dependent: :destroy has_many :ui_sections, through: :ui_associations has_many :revisions, through: :ui_associations has_many :pages, through: :revisions scope :footer, joins(:ui_sections).where(georgia_ui_sections: {name: 'Footer'}) scope :submenu, joins(:ui_sections).where(georgia_ui_sections: {name: 'Submenu'}) scope :sidebar, joins(:ui_sections).where(georgia_ui_sections: {name: 'Sidebar'}) validate :content_presence def content_presence contents.each do |content| errors.add(:base, I18n.t("locales.#{content.locale}") + ' Title is required.') unless content.title.present? end end def featured? @featured ||= pages.any? end def featured_count @featured_count ||= pages.count end end end
Version data entries
7 entries across 7 versions & 1 rubygems