Class: ActiveRecord::Embedded::Field::TypeError

Inherits:
Error
  • Object
show all
Defined in:
lib/active_record/embedded/field/type_error.rb

Overview

Thrown when a configured field type cannot be handled as JSON.

Instance Method Summary collapse

Constructor Details

#initialize(klass) ⇒ TypeError

Returns a new instance of TypeError


8
9
10
11
12
# File 'lib/active_record/embedded/field/type_error.rb', line 8

def initialize(klass)
  type = klass.to_s.demodulize
  types = Field.types.to_sentence
  super "'#{type}' is not a valid type. Valid types are #{types}."
end