Class: Cmsable::Content

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/cmsable/content.rb

Class Method Summary collapse

Class Method Details

.get(name) ⇒ Object



20
21
22
23
24
25
# File 'app/models/cmsable/content.rb', line 20

def self.get name
  find_or_create_by name: name do |record|
    body = I18n.t("cmsable.#{name}", default: "<p>Awaiting Content</p><script>alert('Cmsable entry \"#{name}\" is awaiting content');</script>")
    record.update body: body
  end
end

.set(name, body) ⇒ Object

Class Methods



16
17
18
# File 'app/models/cmsable/content.rb', line 16

def self.set name, body
  find_by_name(name).update_attribute :body, body
end