Sha256: db0c5c12eab55433001c06a87bffd1d5f45622867b7850837e87dd3cc63a12cd
Contents?: true
Size: 630 Bytes
Versions: 27
Compression:
Stored size: 630 Bytes
Contents
class Content < ActiveRecord::Base has_paper_trail # belongs_to :contentable, :polymorphic => true validate :name, :unique => true acts_as_indexed :fields => [:body, :key, :note] include Soapbox::Content if File.exists? "app/models/soapbox/content.rb" # Content[name] def self.[](key) find_or_create_by_key(key).try(:body) end def self.named(key) find_or_create_by_key(key) end def self.[]=(key, v) setting = find_or_create_by_key(key) setting.value = (v ? v : "") setting.save setting.value end # usage @page.contents[:sidebar] # usage @page.contents[:summary] end
Version data entries
27 entries across 27 versions & 1 rubygems