根据文档配置后,gem activity_notification
没有创建/触发。我试图在用户创建评论或回复现有评论的情况下创建通知,但不创建/触发gem。请帮我弄清楚原因。
这是我的代码
class User < ApplicationRecord
audited
with_options dependent: :destroy do |assoc|
assoc.has_many :forums, class_name: 'Communication::Forum'
assoc.has_many :favorited_forums, class_name: 'Communication::FavoritedForum'
assoc.has_many :comments
assoc.has_many :likes
end
acts_as_target
end
class Communication::Forum < ApplicationRecord
audited
belongs_to :user
acts_as_commentable
has_many :likes, as: :likeable
has_many :favorited_forums, class_name: "Communication::FavoritedForum"
end
class Comment < ActiveRecord::Base
audited
acts_as_nested_set scope: [:commentable_id, :commentable_type]
belongs_to :commentable, polymorphic: true
acts_as_notifiable :users,
targets: ->(comment, key) {
([comment.commentable.user] + [comment.user]).uniq
}
end