Sha256: f124d9cd1c82fec9ef10f68f4f3290e89df2d2bac056308c2dbf4a36d8bedf3f

Contents?: true

Size: 952 Bytes

Versions: 4

Compression:

Stored size: 952 Bytes

Contents

module Enjoy::Faq
  module Models
    module Question
      extend ActiveSupport::Concern
      include Enjoy::Model
      include Enjoy::Enableable

      include Enjoy::Seoable
      include Enjoy::SitemapDataField
      include ManualSlug

      include Enjoy::Faq.orm_specific('Question')

      included do
        manual_slug :full_name

        apply_simple_captcha message: Enjoy::Faq.configuration.captcha_error_message

        validates_email_format_of :author_email
        if Enjoy::Faq.config.author_name_required
          validates_presence_of :author_name
        end
        validates_presence_of :question_text, :author_email
      end

      def name
        "#{self.question_text_output} (#{self.author_name_output})"
      end

      def full_name
        "#{self.author_name_output}: \"#{self.question_text_output}\""
      end

      def question_category_class
        Enjoy::Faq::QuestionCategory
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
enjoy_cms_faq-0.3.5 lib/enjoy/faq/models/question.rb
enjoy_cms_faq-0.3.2 lib/enjoy/faq/models/question.rb
enjoy_cms_faq-0.3.1 lib/enjoy/faq/models/question.rb
enjoy_cms_faq-0.3.0.2 lib/enjoy/faq/models/question.rb