I'm trying to implement a facebook like notification system in Rails using public activity and gem unread. I have installed the gem and created a public_activity.rb file in config/initializers. Code
PublicActivity::Activity.class_eval do
acts_as_readable :on => :created_at
end
How do I create my views such that I can show the number of unread messages and also highlight these messages in my activities index.
My initial attempt at this looks like so
<%= PublicActivity::Activity.order("created_at desc").where(owner_id: current_user.following_ids , owner_type: "User").unread_by(current_user).count %>
This gives me all notifications instead of just the unread ones. A Any ideas on how I can modify this?