Class: ActiveType::TypeCaster::NativeCasters::DelegateToRailsType

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) ⇒ DelegateToRailsType

Returns a new instance of DelegateToRailsType.



103
104
105
# File 'lib/active_type/type_caster.rb', line 103

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

Instance Method Details

#type_cast_from_user(value) ⇒ Object



107
108
109
# File 'lib/active_type/type_caster.rb', line 107

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