Sha256: 51ca52a7a97ee0a3987a3d993349c3a814d09decfec18983e8d0f6b4e3f073f6

Contents?: true

Size: 677 Bytes

Versions: 47

Compression:

Stored size: 677 Bytes

Contents

module RocketCMS
  module Models
    module ContactMessage
      extend ActiveSupport::Concern
      include RocketCMS::Model
      include RocketCMS.orm_specific('ContactMessage')

      included do
        apply_simple_captcha
        validates_email_format_of :email, unless: 'email.blank?'
        if RocketCMS.configuration.contacts_message_required
          validates_presence_of :content
        end
        validate do
          if email.blank? && phone.blank?
            errors.add(:email, I18n.t('rs.no_contact_info'))
          end
        end
        after_create do
          ContactMailer.new_message_email(self).deliver
        end
      end
    end
  end
end

Version data entries

47 entries across 47 versions & 1 rubygems

Version Path
rocket_cms-0.7.1 lib/rocket_cms/models/contact_message.rb
rocket_cms-0.7.0 lib/rocket_cms/models/contact_message.rb
rocket_cms-0.6.18 lib/rocket_cms/models/contact_message.rb
rocket_cms-0.6.17 lib/rocket_cms/models/contact_message.rb
rocket_cms-0.6.16 lib/rocket_cms/models/contact_message.rb
rocket_cms-0.6.15 lib/rocket_cms/models/contact_message.rb
rocket_cms-0.6.14 lib/rocket_cms/models/contact_message.rb
rocket_cms-0.6.13 lib/rocket_cms/models/contact_message.rb
rocket_cms-0.6.12 lib/rocket_cms/models/contact_message.rb
rocket_cms-0.6.11 lib/rocket_cms/models/contact_message.rb
rocket_cms-0.6.10 lib/rocket_cms/models/contact_message.rb
rocket_cms-0.6.9 lib/rocket_cms/models/contact_message.rb
rocket_cms-0.6.8 lib/rocket_cms/models/contact_message.rb
rocket_cms-0.6.7 lib/rocket_cms/models/contact_message.rb
rocket_cms-0.6.6 lib/rocket_cms/models/contact_message.rb
rocket_cms-0.6.5 lib/rocket_cms/models/contact_message.rb
rocket_cms-0.6.4 lib/rocket_cms/models/contact_message.rb
rocket_cms-0.6.3 lib/rocket_cms/models/contact_message.rb
rocket_cms-0.6.2 lib/rocket_cms/models/contact_message.rb
rocket_cms-0.6.1 lib/rocket_cms/models/contact_message.rb