class FeedBack < ActiveRecord::Base
  VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i

  validates :email, presence: true,
            format: { with: VALID_EMAIL_REGEX }

  validates :name, presence: true, length: { minimum: 2, maximum: 50 }
  validates :text, presence: true, length: { minimum: 10, maximum: 1500 }

  validates :phone, allow_blank: true,
            :length => { :minimum => 7, :maximum => 20 }

end
