Rails Model Validations
EMAIL_REGEX = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]+)\z/i
validates :email, uniqueness: { case_sensitive: false }, format: { with: EMAIL_REGEX }
validates :first_name, :last_name, :email, presence: true
validates :amount, presence: true, numericality: true
before_save :downcase_fields
def downcase_fields
self.email.downcase
end