Class: ActiveRecord::Embedded::Field::Array

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

Overview

Store an Array in the database as a JSON Array. Much like Field::Hash, the JSON library in Ruby is used to encode this value (and the values within it) to JSON.

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


10
11
12
# File 'lib/active_record/embedded/field/array.rb', line 10

def cast(value)
  value.to_a
end