Class: Papercat::Page

Inherits:
Document
  • Object
show all
Defined in:
app/models/papercat/page.rb

Instance Method Summary collapse

Methods inherited from Document

at, get, #set

Instance Method Details

#as_json(options = {}) ⇒ Object



13
14
15
# File 'app/models/papercat/page.rb', line 13

def as_json options = {}
  super(options.update(methods: [:pathname, :title, :meta, :body, :default], except: [:data]))
end

#meta=(val) ⇒ Object

ensure meta always will be saved as json instead of json string



8
9
10
11
# File 'app/models/papercat/page.rb', line 8

def meta=val
  val = JSON.parse(val) if val.is_a?(String)
  write_store_attribute(:data, :meta, val)
end