Sha256: 198f087867688d377c76b4a33e4fa199fd11a5f2046d584434a610ddcc7e0e57
Contents?: true
Size: 603 Bytes
Versions: 109
Compression:
Stored size: 603 Bytes
Contents
class MigrateDescApidaeObjFields < ActiveRecord::Migration[5.2] def change Apidae::Obj.all.select(:id, :root_obj_id, :description_data).each do |o| ['theme_desc', 'private_desc'].each do |desc_field| if !o.description_data.blank? && !o.description_data[desc_field].blank? && o.description_data[desc_field].is_a?(Hash) && o.description_data[desc_field].values[0].is_a?(String) o.description_data[desc_field].each_pair do |th, val| o.description_data[desc_field][th] = {'fr' => val} end end end o.save! end end end
Version data entries
109 entries across 109 versions & 1 rubygems