Module: Statham::Document

Extended by:
ActiveSupport::Concern
Defined in:
lib/statham/document.rb

Overview

Public: Mixin for ActiveRecord models which enables defining attributes serialized into a JSON attribute.

Examples

class Foo < ActiveRecord::Base
  include Statham::Document

  statham :metdata do |json|
    json.attribute :foo, type: :integer
    json.attribute :bar
  end
end

Each attribute is given name and options including type and default value.

Defined Under Namespace

Modules: ClassMethods