Sha256: f3ea8bb8260883cb8cbffb77fd1a16fff5bc0012b9feb7cbd6dc9b1499c0b34a
Contents?: true
Size: 1.11 KB
Versions: 11
Compression:
Stored size: 1.11 KB
Contents
module Cmor::Contact class ContactRequest < ApplicationRecord module SubjectConcern extend ActiveSupport::Concern included do validates :subject, presence: true end end module PhoneConcern extend ActiveSupport::Concern included do validates :phone, presence: true end end Configuration.contact_request_include_modules.call.each do |mod| include mod end validates :name, presence: true validates :email, 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
11 entries across 11 versions & 1 rubygems