Sha256: a3f2d6351d298fb16bc63d8ff643526ad44de8c838796b7cc5508ae579efc584
Contents?: true
Size: 896 Bytes
Versions: 3
Compression:
Stored size: 896 Bytes
Contents
module ActiveadminSelleoCms class Section < ActiveRecord::Base include ContentTranslation translates :body, fallbacks_for_empty_translations: true attr_protected :id belongs_to :sectionable, polymorphic: true accepts_nested_attributes_for :translations validates_presence_of :name validates_uniqueness_of :name, scope: [:sectionable_type, :sectionable_id] validates_associated :translations scope :with_name, ->(section_name) { where(name: section_name) } scope :blurbs, where("name ILIKE 'blurb.%'") scope :help, where("name ILIKE 'help.%'") def toolbar case name when /blurb\./ then "Easy" when /help\./ then "Lite" else "Easy" end end class Translation attr_protected :id has_many :attachments, as: :assetable accepts_nested_attributes_for :attachments end end end
Version data entries
3 entries across 3 versions & 1 rubygems