Created
May 22, 2019 11:18
-
-
Save hkilis/f22e58f0f75b3b13ee4d8b76ab509cb4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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