diff --git a/app/controllers/page_collections_controller.rb b/app/controllers/page_collections_controller.rb index c914f0ae..8b9b62e3 100644 --- a/app/controllers/page_collections_controller.rb +++ b/app/controllers/page_collections_controller.rb @@ -13,6 +13,8 @@ class PageCollectionsController < ApplicationController @network_collections = PageCollection.where(user_id: followed_user_ids, privacy: 'public') @random_collections = PageCollection.where(privacy: 'public').sample(9) + + @followed_collections = current_user.followed_page_collections end # GET /page_collections/1 diff --git a/app/models/users/user.rb b/app/models/users/user.rb index 08b8da8d..5637ba2f 100644 --- a/app/models/users/user.rb +++ b/app/models/users/user.rb @@ -75,6 +75,7 @@ class User < ApplicationRecord @published_in_page_collections ||= PageCollection.where(id: ids) end has_many :page_collection_followings, dependent: :destroy + has_many :followed_page_collections, through: :page_collection_followings, source: :page_collection has_many :page_collection_reports, dependent: :destroy has_many :votes, dependent: :destroy diff --git a/app/views/page_collections/index.html.erb b/app/views/page_collections/index.html.erb index 625d9e82..e0c08608 100644 --- a/app/views/page_collections/index.html.erb +++ b/app/views/page_collections/index.html.erb @@ -46,6 +46,36 @@ <% end %> +<% if @followed_collections.any? %> +