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.

Instance Method Summary collapse

Constructor Details

#initialize(user, paginated_scope) ⇒ PostsPageView

Returns a new instance of PostsPageView.

Parameters:


21
22
23
24
25
26
# File 'app/view_models/thredded/posts_page_view.rb', line 21

def initialize(user, paginated_scope)
  @posts_paginator = paginated_scope
  @post_views = paginated_scope.map do |post|
    Thredded::PostView.new(post, Pundit.policy!(user, post))
  end
end