Newer
Older
dmpopidor / lib / data_cleanup / rules / plan / fix_blank_title.rb
@Gavin Morrice Gavin Morrice on 21 Aug 2018 411 bytes Add tests for locale setting (#1823)
module DataCleanup
  module Rules
    module Plan
      class FixBlankTitle < Rules::Base

        def description
          "Fix blank title on Plan"
        end

        def call
          ::Plan.where(title: [nil, '']).each do |plan|
            log("Updating title on Plan#{plan.id}")
            plan.update!(title: "My plan (#{plan.template.title})")
          end
        end
      end
    end
  end
end