Class: ActiveType::TypeCaster::NativeCasters::DelegateToRails5Type

Inherits:
Object
  • Object
show all
Defined in:
lib/active_type/type_caster.rb

Overview

Adapter for Rails 5+. In these versions, casting logic lives in subclasses of ActiveRecord::Type::Value

Instance Method Summary collapse

Constructor Details

#initialize(type) ⇒ DelegateToRails5Type

Returns a new instance of DelegateToRails5Type.



109
110
111
# File 'lib/active_type/type_caster.rb', line 109

def initialize(type)
  @active_record_type = lookup(type)
end

Instance Method Details

#type_cast_from_user(value) ⇒ Object



113
114
115
# File 'lib/active_type/type_caster.rb', line 113

def type_cast_from_user(value)
  @active_record_type.cast(value)
end