Class: Thredded::PostsPageView
- Inherits:
-
Object
- Object
- Thredded::PostsPageView
- Defined in:
- app/view_models/thredded/posts_page_view.rb
Overview
A view model for a page of PostViews.
Direct Known Subclasses
Instance Attribute Summary collapse
- #topic ⇒ Thredded::BaseTopicView readonly
Instance Method Summary collapse
-
#initialize(user, paginated_scope, topic_view: nil) ⇒ PostsPageView
constructor
A new instance of PostsPageView.
Constructor Details
#initialize(user, paginated_scope, topic_view: nil) ⇒ PostsPageView
Returns a new instance of PostsPageView.
20 21 22 23 24 25 |
# File 'app/view_models/thredded/posts_page_view.rb', line 20 def initialize(user, paginated_scope, topic_view: nil) @paginated_scope = paginated_scope @post_views = paginated_scope.map do |post| Thredded::PostView.new(post, Pundit.policy!(user, post), topic_view: topic_view) end end |
Instance Attribute Details
#topic ⇒ Thredded::BaseTopicView (readonly)
16 17 18 |
# File 'app/view_models/thredded/posts_page_view.rb', line 16 def topic @topic end |