diff --git a/app/models/notification.rb b/app/models/notification.rb index db1b9b32..c0a99f68 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -31,7 +31,7 @@ class Notification < ApplicationRecord notif_type = target.notification_type return nil unless notif_type - notif = notif_type.find_by(recipient: recipient, target: target) + notif = Notification.find_by(recipient: recipient, target: target) notif.destroy unless notif.nil? end @@ -39,7 +39,6 @@ class Notification < ApplicationRecord def make_notification(recipient, target, notification_type) n = notification_type.new(target: target, - target_type: target.class.name, # To ensure we don't get a type of 'Appenddable' recipient: recipient, new: true) n.save! diff --git a/app/views/navigation/main/_notifications.haml b/app/views/navigation/main/_notifications.haml index 75d80928..2763591c 100644 --- a/app/views/navigation/main/_notifications.haml +++ b/app/views/navigation/main/_notifications.haml @@ -19,7 +19,7 @@ - else - notifications.each do |notification| .dropdown-item - = render "notifications/type/#{notification.target_type.downcase.split('::').last}", notification: notification + = render "notifications/type/#{notification.target.type.downcase.split('::').last}", notification: notification %a.dropdown-item.text-center{ href: notifications_path } %i.fa.fa-fw.fa-chevron-right