Class: SlugPatternValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
app/validators/slug_pattern_validator.rb

Instance Method Summary collapse

Instance Method Details

#string_replaced(value) ⇒ Object



10
11
12
13
14
15
# File 'app/validators/slug_pattern_validator.rb', line 10

def string_replaced value
	email_removal_for_morons value
	intelligently_de_dot value
	finish_normalizing value
	value
end

#validate_each(record, attribute, value) ⇒ Object



2
3
4
5
6
7
8
# File 'app/validators/slug_pattern_validator.rb', line 2

def validate_each record, attribute, value
if value.blank?
	record.errors[attribute] << "cannot be blank"
else
	return string_replaced value
end
end