class ActiveType::TypeCaster::NativeCasters::DelegateToRails4Type
Adapter for Rails 4.2+. In these versions, casting logic lives in subclasses of ActiveRecord::Type::Value
Public Class Methods
new(type)
click to toggle source
# File lib/active_type/type_caster.rb, line 91 def initialize(type) # The specified type (e.g. "string") may not necessary match the # native type ("varchar") expected by the connection adapter. # PostgreSQL is one of these. Perform a translation if the adapter # supports it (but don't turn a mysql boolean into a tinyint). @active_record_type = ActiveRecord::ConnectionAdapters::AbstractAdapter.new(nil).lookup_cast_type(type) end
Public Instance Methods
type_cast_from_user(value)
click to toggle source
# File lib/active_type/type_caster.rb, line 99 def type_cast_from_user(value) @active_record_type.type_cast_from_user(value) end