Module: Barley::Serializable

Extended by:
ActiveSupport::Concern
Defined in:
lib/barley/serializable.rb

Overview

Makes a Model serializable

  • Allows setting a default model Serializer

Examples:

class Item < ApplicationRecord
  include Barley::Serializable

 # optionally define the default serializer, otherwise defaults to ItemSerializer
 serializer MyCustomItemSerializer, cache: true
end

#> Item.as_json