module Outpost::Model::Serializer

Public Instance Methods

as_json(*args) click to toggle source

Define some defaults for as_json Override #json to add attributes or override any of these.

Calls superclass method
# File lib/outpost/model/serializer.rb, line 16
def as_json(*args)
  super.merge({
    "id"         => self.obj_key,
    "obj_key"    => self.obj_key,
    "link_path"  => self.public_path,
    "to_title"   => self.to_title,
    "edit_path"  => self.admin_edit_path
  }).merge(self.json.stringify_keys!)
end
json() click to toggle source

This method should be overridden Don't override as_json unless you don't want its baked-in goodies

# File lib/outpost/model/serializer.rb, line 9
def json
  {}
end