Sha256: ec510b43ce71bd5b1a12ecac1392f9b7c6fb93a2dade1c93008d4138e3abc50b

Contents?: true

Size: 426 Bytes

Versions: 3

Compression:

Stored size: 426 Bytes

Contents

module Rapidfire
  module Questions
    class Select < Rapidfire::Question
      validates :answer_options, :presence => true

      def options
        answer_options.split(/\r?\n/)
      end

      def validate_answer(answer)
        super(answer)

        if rules[:presence] == "1" || answer.answer_text.present?
          answer.validates_inclusion_of :answer_text, :in => options
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
unique_rapidfire-1.0.0 app/models/rapidfire/questions/select.rb
rapidfire-1.2.0 app/models/rapidfire/questions/select.rb
rapidfire-1.0.0 app/models/rapidfire/questions/select.rb