Sha256: b5c015ddecdd443c0c7be452d6656139624fa3d9681790ffbf6f897d964e1d94
Contents?: true
Size: 790 Bytes
Versions: 21
Compression:
Stored size: 790 Bytes
Contents
module Cmor::Contact class ContactRequest < ApplicationRecord validates :name, presence: true validates :email, presence: true validates :phone, presence: true validates :ip_address, presence: true validates :message, presence: true validates :accept_terms_of_service, acceptance: true module SpamProtection attr_accessor :nickname def save if nickname.present? valid? return true else super end end end module Notification def self.included(base) base.after_save :notify, if: -> { notified_at.nil? } end def notify NotifyNewContactRequestJob.perform_later(id) end end prepend SpamProtection include Notification end end
Version data entries
21 entries across 21 versions & 1 rubygems