Basic contact model validations

This commit is contained in:
Andres Keskküla 2014-07-30 13:56:49 +03:00
parent 1e2dad06f9
commit 3caac94bfb
3 changed files with 31 additions and 0 deletions

View file

@ -4,6 +4,8 @@ class Contact < ActiveRecord::Base
has_many :addresses
validates_presence_of :code, :name, :phone, :email, :ident
validate :ident_must_be_valid
validates :phone, format: { with: /\+\d{3}\.\d+/, message: "bad format" }