Sha256: 24c5a20af5f296e9eb5122dad5a3722f6261db93f4a8587ff384efaf2e96d7b3

Contents?: true

Size: 438 Bytes

Versions: 121

Compression:

Stored size: 438 Bytes

Contents

# frozen_string_literal: true

module ActiveRecord
  module TypeCaster
    class Map # :nodoc:
      def initialize(klass)
        @klass = klass
      end

      def type_cast_for_database(attr_name, value)
        type = type_for_attribute(attr_name)
        type.serialize(value)
      end

      def type_for_attribute(name)
        klass.type_for_attribute(name)
      end

      private
        attr_reader :klass
    end
  end
end

Version data entries

121 entries across 116 versions & 11 rubygems

Version Path
activerecord-7.0.0.rc3 lib/active_record/type_caster/map.rb
activerecord-6.1.4.3 lib/active_record/type_caster/map.rb
activerecord-6.1.4.2 lib/active_record/type_caster/map.rb
activerecord-7.0.0.rc2 lib/active_record/type_caster/map.rb
activerecord-7.0.0.rc1 lib/active_record/type_caster/map.rb
date_n_time_picker_activeadmin-0.1.2 vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.4.1/lib/active_record/type_caster/map.rb
date_n_time_picker_activeadmin-0.1.1 vendor/bundle/ruby/2.6.0/gems/activerecord-6.1.4.1/lib/active_record/type_caster/map.rb
activerecord-7.0.0.alpha2 lib/active_record/type_caster/map.rb
activerecord-7.0.0.alpha1 lib/active_record/type_caster/map.rb
activerecord-6.1.4.1 lib/active_record/type_caster/map.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/activerecord-6.1.4/lib/active_record/type_caster/map.rb
activerecord-6.1.4 lib/active_record/type_caster/map.rb
activerecord-6.1.3.2 lib/active_record/type_caster/map.rb
activerecord-6.1.3.1 lib/active_record/type_caster/map.rb
activerecord-6.1.3 lib/active_record/type_caster/map.rb
activerecord-6.1.2.1 lib/active_record/type_caster/map.rb
activerecord-6.1.2 lib/active_record/type_caster/map.rb
activerecord-6.1.1 lib/active_record/type_caster/map.rb
activerecord-6.1.0 lib/active_record/type_caster/map.rb
activerecord-6.1.0.rc2 lib/active_record/type_caster/map.rb