Class: Thredded::UserPostNotification
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Thredded::UserPostNotification
- Defined in:
- app/models/thredded/user_post_notification.rb
Overview
Delivery records for Thredded::Post notifications.
Class Method Summary collapse
-
.create_from_post_and_user(post, user) ⇒ Boolean
Create a user-post notification record for a given post and a user.
-
.notified_user_ids(post) ⇒ Array<Integer>
The IDs of users who were already notified about the given post.
Class Method Details
.create_from_post_and_user(post, user) ⇒ Boolean
Create a user-post notification record for a given post and a user.
19 20 21 22 23 24 25 26 27 |
# File 'app/models/thredded/user_post_notification.rb', line 19 def self.create_from_post_and_user(post, user) create( post_id: post.id, user_id: user.id, notified_at: Time.zone.now ) rescue ActiveRecord::RecordNotUnique false end |
.notified_user_ids(post) ⇒ Array<Integer>
Returns The IDs of users who were already notified about the given post.
11 12 13 |
# File 'app/models/thredded/user_post_notification.rb', line 11 def self.notified_user_ids(post) where(post_id: post.id).pluck(:user_id) end |