Sha256: 73a6a0134b7fae1625418836100c024c52dfd262c6c18b67ca6c5c89cc5488a0

Contents?: true

Size: 450 Bytes

Versions: 3

Compression:

Stored size: 450 Bytes

Contents

# frozen_string_literal: true

module Fields
  class IntegerField < Field
    serialize :validations, Validations::IntegerField
    serialize :options, Options::IntegerField

    def stored_type
      :integer
    end

    protected

    def interpret_extra_to(model, accessibility, _overrides = {})
      return if accessibility != :read_and_write

      model.validates name, numericality: {only_integer: true}, allow_blank: true
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
script_core-0.1.0 spec/dummy/app/models/fields/integer_field.rb
script_core-0.0.6 spec/dummy/app/models/fields/integer_field.rb
script_core-0.0.5 spec/dummy/app/models/fields/integer_field.rb