Use `target.class.name` instead of `target.type`

This only worked for polymorphic relations
This commit is contained in:
Karina Kwiatek 2022-07-09 00:07:57 +02:00 committed by Karina Kwiatek
parent 90b2aa0110
commit 39d55e52c8
2 changed files with 2 additions and 2 deletions

View File

@ -19,7 +19,7 @@
- else - else
- notifications.each do |notification| - notifications.each do |notification|
.dropdown-item .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 } %a.dropdown-item.text-center{ href: notifications_path }
%i.fa.fa-fw.fa-chevron-right %i.fa.fa-fw.fa-chevron-right

View File

@ -13,7 +13,7 @@
- @notifications.each do |notification| - @notifications.each do |notification|
%li.list-group-item %li.list-group-item
.media .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? - unless @notifications.count.zero?
= render 'shared/cursored_pagination_dummy', more_data_available: @more_data_available, last_id: @notifications_last_id, permitted_params: %i[type] = render 'shared/cursored_pagination_dummy', more_data_available: @more_data_available, last_id: @notifications_last_id, permitted_params: %i[type]