diff --git a/app/models/concerns/has_content.rb b/app/models/concerns/has_content.rb index 2b98d764..2a58c568 100644 --- a/app/models/concerns/has_content.rb +++ b/app/models/concerns/has_content.rb @@ -96,15 +96,13 @@ module HasContent # [..., ..., ...] def recent_content_list - content_types = Rails.application.config.content_types[:all] - - @user_recent_content_list ||= content_types.flat_map { |klass| - klass.where(user_id: id) - .order(updated_at: :desc) - .limit(10) - }.sort_by(&:updated_at) - .last(10) - .reverse + recently_changed_attributes = Attribute.where(user: self) + .order('updated_at desc') + .group([:entity_type, :entity_id]) + .limit(10) + @user_recent_content_list = recently_changed_attributes.map do |attr| + attr.entity_type.constantize.find_by(id: attr.entity_id) + end.compact end end end diff --git a/app/views/layouts/_sidenav.html.erb b/app/views/layouts/_sidenav.html.erb index 0ac4b679..31ada4c6 100644 --- a/app/views/layouts/_sidenav.html.erb +++ b/app/views/layouts/_sidenav.html.erb @@ -109,7 +109,6 @@ <%= link_to main_app.customization_content_types_path do %> add Customize pages - <% end %>