Sha256: aa0870905dbe5a6bd60e9dbd839a216d09a2f35339bab518a78bc63c43f174ed
Contents?: true
Size: 480 Bytes
Versions: 7
Compression:
Stored size: 480 Bytes
Contents
module PagesCms class Contact < ActiveRecord::Base belongs_to :account 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 validates :message, presence: true validate :has_account private def has_account if self.account.nil? errors.add(:base, 'Must be associated with an account') end end end end
Version data entries
7 entries across 7 versions & 1 rubygems