Class: ActiveType::TypeCaster::NativeCasters::DelegateToRailsType
- Inherits:
-
Object
- Object
- ActiveType::TypeCaster::NativeCasters::DelegateToRailsType
- 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
-
#initialize(type) ⇒ DelegateToRailsType
constructor
A new instance of DelegateToRailsType.
- #type_cast_from_user(value) ⇒ Object
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 |