module DuckRecord::Serialization

Active Record Serialization

Private Instance Methods

read_attribute_for_serialization(key) click to toggle source
# File lib/duck_record/serialization.rb, line 13
def read_attribute_for_serialization(key)
  v = send(key)
  if v.respond_to?(:serializable_hash)
    v.serializable_hash
  elsif v.respond_to?(:to_ary)
    v.to_ary
  elsif v.respond_to?(:to_hash)
    v.to_hash
  else
    v
  end
end