From 5dc5842f223c8c1c5024c7ac5a52b5de40201060 Mon Sep 17 00:00:00 2001 From: Chris Oliver Date: Mon, 30 Dec 2024 09:48:22 -0600 Subject: [PATCH] Update UPGRADE.md --- UPGRADE.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/UPGRADE.md b/UPGRADE.md index 9d3c3e7..a4f196e 100644 --- a/UPGRADE.md +++ b/UPGRADE.md @@ -30,13 +30,14 @@ rails db:migrate To migrate your data to the new tables, loop through your existing notifications and create new records for each one. You can do this in a Rake task or in the Rails console: ```ruby -# Temporarily define the Notification model to access the old table -class Notification < ActiveRecord::Base +# Temporarily define the model to access the old table +class TempNotification < ActiveRecord::Base self.inheritance_column = nil + self.table_name = "notifications" end # Migrate each record to the new tables -Notification.find_each do |notification| +TempNotification.find_each do |notification| attributes = notification.attributes.slice("type", "created_at", "updated_at").with_indifferent_access attributes[:type] = attributes[:type].sub("Notification", "Notifier") attributes[:params] = Noticed::Coder.load(notification.params)