From 39d55e52c816d23325c08c09f4981235451ceb06 Mon Sep 17 00:00:00 2001 From: Karina Kwiatek Date: Sat, 9 Jul 2022 00:07:57 +0200 Subject: [PATCH] Use `target.class.name` instead of `target.type` This only worked for polymorphic relations --- app/views/navigation/main/_notifications.haml | 2 +- app/views/notifications/index.haml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/navigation/main/_notifications.haml b/app/views/navigation/main/_notifications.haml index 2763591c..41a18b79 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.class.name.downcase.split('::').last}", notification: notification %a.dropdown-item.text-center{ href: notifications_path } %i.fa.fa-fw.fa-chevron-right diff --git a/app/views/notifications/index.haml b/app/views/notifications/index.haml index 41a92858..75871f42 100644 --- a/app/views/notifications/index.haml +++ b/app/views/notifications/index.haml @@ -13,7 +13,7 @@ - @notifications.each do |notification| %li.list-group-item .media - = render "notifications/type/#{notification.target_type.downcase.split('::').last}", notification: notification + = render "notifications/type/#{notification.target.class.name.downcase.split('::').last}", notification: notification - unless @notifications.count.zero? = render 'shared/cursored_pagination_dummy', more_data_available: @more_data_available, last_id: @notifications_last_id, permitted_params: %i[type]