Class: Thredded::PrivatePost
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Thredded::PrivatePost
- Includes:
- PostCommon
- Defined in:
- app/models/thredded/private_post.rb
Instance Method Summary collapse
- #page(per_page: self.class.default_per_page) ⇒ Object
- #private_topic_post? ⇒ Boolean
-
#readers ⇒ ActiveRecord::Relation<Thredded.user_class>
Users that can read this post.
Methods included from PostCommon
#avatar_url, #calculate_page, #filtered_content, #first_post_in_topic?, #mark_as_unread, #previous_post, #readers_from_user_names
Instance Method Details
#page(per_page: self.class.default_per_page) ⇒ Object
25 26 27 |
# File 'app/models/thredded/private_post.rb', line 25 def page(per_page: self.class.default_per_page) calculate_page(postable.posts, per_page) end |
#private_topic_post? ⇒ Boolean
29 30 31 |
# File 'app/models/thredded/private_post.rb', line 29 def private_topic_post? true end |
#readers ⇒ ActiveRecord::Relation<Thredded.user_class>
Returns users that can read this post.
34 35 36 37 38 39 40 41 |
# File 'app/models/thredded/private_post.rb', line 34 def readers collection_proxy = postable.users if persisted? collection_proxy.scope else Thredded.user_class.where(id: collection_proxy.to_a.map(&:id)) end end |