Class: Papercat::Page
- Defined in:
- app/models/papercat/page.rb
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#meta=(val) ⇒ Object
ensure meta always will be saved as json instead of json string.
Methods inherited from Document
Instance Method Details
#as_json(options = {}) ⇒ Object
13 14 15 |
# File 'app/models/papercat/page.rb', line 13 def as_json = {} super(.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 val val = JSON.parse(val) if val.is_a?(String) write_store_attribute(:data, :meta, val) end |