Skip to content

Override the default numeric input that SimpleForm provides so that it uses validations found on the Rails models to determine min/max values

License

Notifications You must be signed in to change notification settings

thefrontiergroup/frontier_simple_form_numeric_input

Repository files navigation

Frontier SimpleForm Numeric Input

Installing this gem will override the SimpleForm::Inputs::NumericInput with the NumericInput class. The NumericInput class uses a model's numericality validations to set the min and max values for an input.

Installation

gem 'frontier_simple_form_numeric_input', github: 'thefrontiergroup/frontier_simple_form_numeric_input'

Usage

Installing the gem will cause the SimpleForm::Inputs::NumericInput to be overrided automatically.

By default, this will cause all the NumericInputs in your application to try and use your model's existing validations to set the min and max values on the input.

These min and max values can be overriden as you normally would with a SimpleForm input:

= simple_form_for(@user) do |f|
  = f.input :age, input_html: {min: 18, max: 90}

About

Override the default numeric input that SimpleForm provides so that it uses validations found on the Rails models to determine min/max values

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages