Method: Entangled::Model::InstanceMethods#as_json

Defined in:
lib/entangled/model.rb

#as_json(options = nil) ⇒ Object

Override the as_json method so that the JSON representation of the resource includes its errors. This is necessary so that errors are sent back to the client along with the resource on create and update


72
73
74
# File 'lib/entangled/model.rb', line 72

def as_json(options = nil)
  super(options || attributes).merge(errors: errors).as_json
end