aboutsummaryrefslogblamecommitdiffstats
path: root/actionview/lib/action_view/helpers/tags/number_field.rb
blob: fc5adfeab18b8d781c0449082e8f9d4ca0b7c18a (plain) (tree)
1
2
3
4
5
6
7
                             

                 

                                             

                                           











                                                                     
# frozen_string_literal: true
module ActionView
  module Helpers
    module Tags # :nodoc:
      class NumberField < TextField # :nodoc:
        def render
          options = @options.stringify_keys

          if range = options.delete("in") || options.delete("within")
            options.update("min" => range.min, "max" => range.max)
          end

          @options = options
          super
        end
      end
    end
  end
end