Currently, I've created custom email validator for rails model.

**models/concerns/email\_validator.rb**

```
class EmailValidator < ActiveModel::EachValidator
  def validate_each(record, attribute, value)
    unless value =~ /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i
      record.errors[attribute] << (options[:message] || "provided format for email is not valid")
    end
  end
end

```

So now I can use it like:

```
validates :email, email: true, uniqueness: true

```

I'm just curious how it's auto included into model? I mean we are not including it explicitly, by using include method.