Class: Bureaucrat::Fields::EmailField

Inherits:
CharField show all
Defined in:
lib/bureaucrat/fields.rb

Instance Attribute Summary

Attributes inherited from CharField

#max_length, #min_length

Attributes inherited from Field

#error_messages, #help_text, #hidden_widget, #initial, #label, #required, #show_hidden_initial, #validators, #widget

Instance Method Summary collapse

Methods inherited from CharField

#initialize, #to_object, #widget_attrs

Methods inherited from Field

#bound_data, #default_hidden_widget, #default_widget, #initialize, #initialize_copy, #populate_object, #prepare_value, #run_validators, #to_object, #validate, #widget_attrs

Constructor Details

This class inherits a constructor from Bureaucrat::Fields::CharField

Instance Method Details

#clean(value) ⇒ Object



383
384
385
386
# File 'lib/bureaucrat/fields.rb', line 383

def clean(value)
  value = to_object(value).strip
  super(value)
end

#default_error_messagesObject



375
376
377
# File 'lib/bureaucrat/fields.rb', line 375

def default_error_messages
  super.merge(invalid: 'Enter a valid e-mail address.')
end

#default_validatorsObject



379
380
381
# File 'lib/bureaucrat/fields.rb', line 379

def default_validators
  [Validators::ValidateEmail]
end