Sha256: c5e3a10973e06a7e4560cef6c335c012b90913df8523161f1ab98cbccba836d5

Contents?: true

Size: 743 Bytes

Versions: 19

Compression:

Stored size: 743 Bytes

Contents

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

      included do

        apply_simple_captcha message: RocketCMS.configuration.contacts_captcha_error_message

        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

19 entries across 19 versions & 1 rubygems

Version Path
ack_rocket_cms-0.7.7.1 lib/rocket_cms/models/contact_message.rb
ack_rocket_cms-0.7.7 lib/rocket_cms/models/contact_message.rb
ack_rocket_cms-0.7.6.4 lib/rocket_cms/models/contact_message.rb
ack_rocket_cms-0.7.6.3 lib/rocket_cms/models/contact_message.rb
ack_rocket_cms-0.7.6.2 lib/rocket_cms/models/contact_message.rb
ack_rocket_cms-0.7.6.1 lib/rocket_cms/models/contact_message.rb
ack_rocket_cms-0.7.6 lib/rocket_cms/models/contact_message.rb
ack_rocket_cms-0.7.5.2 lib/rocket_cms/models/contact_message.rb
ack_rocket_cms-0.7.5.1 lib/rocket_cms/models/contact_message.rb
ack_rocket_cms-0.7.5 lib/rocket_cms/models/contact_message.rb
ack_rocket_cms-0.7.4.1 lib/rocket_cms/models/contact_message.rb
ack_rocket_cms-0.7.4 lib/rocket_cms/models/contact_message.rb
ack_rocket_cms-0.7.3 lib/rocket_cms/models/contact_message.rb
ack_rocket_cms-0.7.2.4 lib/rocket_cms/models/contact_message.rb
ack_rocket_cms-0.7.2.3.2 lib/rocket_cms/models/contact_message.rb
ack_rocket_cms-0.7.2.3.1 lib/rocket_cms/models/contact_message.rb
ack_rocket_cms-0.7.2.3 lib/rocket_cms/models/contact_message.rb
ack_rocket_cms-0.7.2.2 lib/rocket_cms/models/contact_message.rb
ack_rocket_cms-0.7.2.1 lib/rocket_cms/models/contact_message.rb