aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/helpers/tags/number_field.rb
diff options
context:
space:
mode:
Diffstat (limited to 'actionview/lib/action_view/helpers/tags/number_field.rb')
-rw-r--r--actionview/lib/action_view/helpers/tags/number_field.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/actionview/lib/action_view/helpers/tags/number_field.rb b/actionview/lib/action_view/helpers/tags/number_field.rb
new file mode 100644
index 0000000000..4f95b1b4de
--- /dev/null
+++ b/actionview/lib/action_view/helpers/tags/number_field.rb
@@ -0,0 +1,18 @@
+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