Sha256: fb08a7a3869e9e515a08e85faa5300cf7162aa8ec60bb792582eef2547da8717

Contents?: true

Size: 605 Bytes

Versions: 5

Compression:

Stored size: 605 Bytes

Contents

desc 'Earlier delimiter used to be comma(,), but for #19, delimter is changed to \r\n'
namespace :rapidfire do
  task change_delimiter_from_comma_to_srsn: :environment do
    Rapidfire::Question.transaction do
      Rapidfire::Question.all.each do |question|
        if question.is_a?(Rapidfire::Questions::Checkbox) ||
            question.is_a?(Rapidfire::Questions::Select)

          new_answer_options = question.answer_options.split(',')
            .join(Rapidfire.answers_delimiter)
          question.update_attributes!(answer_options: new_answer_options)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rapidfire-4.0.0 lib/tasks/change_delimiter_to_srsn.rake
rapidfire-3.1.0 lib/tasks/change_delimiter_to_srsn.rake
rapidfire-3.0.0 lib/tasks/change_delimiter_to_srsn.rake
rapidfire-2.1.0 lib/tasks/change_delimiter_to_srsn.rake
rapidfire-2.0.0 lib/tasks/change_delimiter_to_srsn.rake