Class: ActiveRecord::Embedded::Field::Hash

Inherits:
ActiveRecord::Embedded::Field show all
Defined in:
lib/active_record/embedded/field/hash.rb

Overview

A JSON “object” type is converted to Ruby as a native Hash with string keys.

Constant Summary

Constants inherited from ActiveRecord::Embedded::Field

PREFIX

Instance Attribute Summary

Attributes inherited from ActiveRecord::Embedded::Field

#default, #name

Instance Method Summary collapse

Methods inherited from ActiveRecord::Embedded::Field

#coerce, #default?, #default_method_name, find, #initialize, types

Constructor Details

This class inherits a constructor from ActiveRecord::Embedded::Field

Instance Method Details

#cast(value) ⇒ Object


9
10
11
# File 'lib/active_record/embedded/field/hash.rb', line 9

def cast(value)
  value.to_h
end