Skip to content

Instantly share code, notes, and snippets.

@hkilis
Created May 22, 2019 11:18
Show Gist options
  • Save hkilis/f22e58f0f75b3b13ee4d8b76ab509cb4 to your computer and use it in GitHub Desktop.
Save hkilis/f22e58f0f75b3b13ee4d8b76ab509cb4 to your computer and use it in GitHub Desktop.
start_date = DateTime.new(2019, 5, 22, 8, 59, 0).utc #change date to start of error
os = Order.unscoped.where("created_at > ?", start_date).includes(:order_items)
os.map do |o|
o.order_items.map do |oi|
if oi.options_ar.present?
begin
JSON.parse(oi.options_ar)
rescue
oi.update_attributes(options_ar: eval(oi.options_ar))
JSON.parse(oi.options_ar)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment