Home Not getting notifications using activity_notification
Reply: 0

Not getting notifications using activity_notification

user1695
1#
user1695 Published in August 15, 2018, 5:36 am

I have an application which use the gem acts_as_follower to user follow each other. I'm also using the activity_notification to notify users about the app. In the acts_as_follower model I have:

follow.rb

class Follow < ActiveRecord::Base

  extend ActsAsFollower::FollowerLib
  extend ActsAsFollower::FollowScopes

  # NOTE: Follows belong to the "followable" interface, and also to followers
  belongs_to :followable, :polymorphic => true
  belongs_to :follower,   :polymorphic => true

  def block!
    self.update_attribute(:blocked, true)
  end

  # acts_as_notifiable configures your model as ActivityNotification::Notifiable
  # with parameters as value or custom methods defined in your model as lambda or symbol.
  # The first argument is the plural symbol name of your target model.
  acts_as_notifiable :users,
  # Notification targets as :targets is a necessary option
  # Set to notify to author and users commented to the article, except comment owner self
    targets: ->(follow, key) {
      ([follow.user] + follow.user.to_a - [follow.user]).uniq
    }

  tracked: true
  # Path to move when the notification is opened by the target user
  # This is an optional configuration since activity_notification uses polymorphic_path as default


end

But I'm not getting the notifications. Should I try

targets: ->(current_user, key) {
  ([current_user.follow] + current_userfollow.to_a - [current_user.follow]).uniq
}

Someone already worked with this gems before? How can I get this notifications working?

I'm using devise for users.

Thanks!!

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.295857 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO