Skip to content
This repository was archived by the owner on Mar 23, 2023. It is now read-only.

Commit 539a972

Browse files
Further refactoring
1 parent 31ddcc2 commit 539a972

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

app/validators/email_validator.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
class EmailValidator < ActiveModel::EachValidator
22
def validate_each(record, attribute, value)
3-
unless (email_valid?(value) && handle_contains_number_of_dots(value) && handle_last_character_is_not_dot(value))
4-
record.errors[attribute] << email_invalid_error_message
5-
end
3+
record.errors[attribute] << email_invalid_error_message unless email_valid?(value) && handle_contains_number_of_dots(value) && handle_last_character_is_not_dot(value)
64
end
75

86
private

0 commit comments

Comments
 (0)