Class: Bureaucrat::Fields::RegexField
- Defined in:
- lib/bureaucrat/fields.rb
Overview
DateField TimeField DateTimeField
Instance Attribute Summary
Attributes inherited from CharField
Attributes inherited from Field
#error_messages, #help_text, #hidden_widget, #initial, #label, #required, #show_hidden_initial, #validators, #widget
Instance Method Summary collapse
-
#initialize(regex, options = {}) ⇒ RegexField
constructor
A new instance of RegexField.
Methods inherited from CharField
Methods inherited from Field
#bound_data, #clean, #default_error_messages, #default_hidden_widget, #default_validators, #default_widget, #initialize_copy, #populate_object, #prepare_value, #run_validators, #to_object, #validate, #widget_attrs
Constructor Details
#initialize(regex, options = {}) ⇒ RegexField
Returns a new instance of RegexField.
358 359 360 361 362 363 364 365 366 367 368 369 370 371 |
# File 'lib/bureaucrat/fields.rb', line 358 def initialize(regex, ={}) = .delete(:error_message) if [:error_messages] ||= {} [:error_messages][:invalid] = end super() @regex = regex validators << Validators::RegexValidator.new(regex: regex) end |