diff options
author | Henare Degan <henare.degan@gmail.com> | 2013-02-25 18:16:30 +1100 |
---|---|---|
committer | Henare Degan <henare.degan@gmail.com> | 2013-02-25 18:16:30 +1100 |
commit | ab2d725012de74cd03f26ad42ad759c16f8615fe (patch) | |
tree | 513cf92d1ff50b961d5bd158a46cf7c53feacf6b | |
parent | 3e4ef4da5374c1dd6d32ac9351decc9bb6851355 (diff) |
Overwriting validate is deprecated
-rw-r--r-- | app/models/contact_validator.rb | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/app/models/contact_validator.rb b/app/models/contact_validator.rb index d277161f9..830ba3019 100644 --- a/app/models/contact_validator.rb +++ b/app/models/contact_validator.rb @@ -27,9 +27,11 @@ class ContactValidator < ActiveRecord::BaseWithoutTable validates_presence_of :email, :message => N_("Please enter your email address") validates_presence_of :subject, :message => N_("Please enter a subject") validates_presence_of :message, :message => N_("Please enter the message you want to send") + validate :email_format - def validate + private + + def email_format errors.add(:email, _("Email doesn't look like a valid address")) unless MySociety::Validate.is_valid_email(self.email) end - end |