I'm trying to send a notification via a different action other than create
. My Article model has a published
boolean attribute/column, and currently I have it so it only sends a notification when an article is created AND published is true.
Here's my article.rb
:
def activity_actor
user
end
def activity_object
self
end
def activity_notify
return if user.followers.empty?
user.followers.map(&:id).map do |user_id|
StreamRails.feed_manager.get_notification_feed(user_id)
end
end
def activity_should_sync?
published
end
def activity_target
return "article_#{Time.now}"
end
I would still like the original functionality (article is created and published
is true), but I would also like a notification sent when an article is already created and published
is updated to true. Therefore, I'd need to send a notification via the update
action.
There doesn't seem to be an obvious way to manually send notifications or to control the trigger that sends notifications. Any help would be appreciated!