Class: Thredded::PostsPageView

Inherits:
Object
  • Object
show all
Defined in:
app/view_models/thredded/posts_page_view.rb

Overview

A view model for a page of PostViews.

Direct Known Subclasses

TopicPostsPageView

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(user, paginated_scope, topic_view: nil) ⇒ PostsPageView

Returns a new instance of PostsPageView.

Parameters:


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

#topicThredded::BaseTopicView (readonly)


16
17
18
# File 'app/view_models/thredded/posts_page_view.rb', line 16

def topic
  @topic
end