Sha256: 0ff594d3c8cf67187ea634c3787a2c6fd71cf211cacc9ea549ad0cb7cb243354

Contents?: true

Size: 594 Bytes

Versions: 2

Compression:

Stored size: 594 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!(answer_options: new_answer_options)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rapidfire-8.0.0 lib/tasks/change_delimiter_to_srsn.rake
rapidfire-5.0.0 lib/tasks/change_delimiter_to_srsn.rake