Sha256: d07a301fc5132b13b1e90a10ade0c27d6c819b1952134787d82239f4f0082d25

Contents?: true

Size: 889 Bytes

Versions: 5

Compression:

Stored size: 889 Bytes

Contents

# frozen_string_literal: true

module Phlexi
  module Form
    module Options
      module InferredTypes
        private

        def infer_field_component
          case inferred_field_type
          when :string, :text
            infer_string_field_type || inferred_field_type
          when :integer, :float, :decimal
            :number
          when :json, :jsonb
            :text
          when :enum
            :select
          when :association
            association_reflection.polymorphic? ? :"polymorphic_#{association_reflection.macro}" : association_reflection.macro
          when :attachment, :binary
            :file
          when :citext
            infer_string_field_type || :string
          when :date, :time, :datetime, :boolean, :hstore
            inferred_field_type
          else
            :string
          end
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
phlexi-form-0.5.0 lib/phlexi/form/options/inferred_types.rb
phlexi-form-0.4.8 lib/phlexi/form/options/inferred_types.rb
phlexi-form-0.4.7 lib/phlexi/form/options/inferred_types.rb
phlexi-form-0.4.6 lib/phlexi/form/options/inferred_types.rb
phlexi-form-0.4.5 lib/phlexi/form/options/inferred_types.rb