Class: Thredded::TopicsPageView
- Inherits:
-
Object
- Object
- Thredded::TopicsPageView
- Defined in:
- app/view_models/thredded/topics_page_view.rb
Overview
A view model for a page of BaseTopicViews.
Instance Method Summary collapse
-
#initialize(user, topics_page_scope, topic_view_class: TopicView) ⇒ TopicsPageView
constructor
A new instance of TopicsPageView.
Constructor Details
#initialize(user, topics_page_scope, topic_view_class: TopicView) ⇒ TopicsPageView
Returns a new instance of TopicsPageView.
20 21 22 23 24 25 |
# File 'app/view_models/thredded/topics_page_view.rb', line 20 def initialize(user, topics_page_scope, topic_view_class: TopicView) @topics_page_scope = refine_scope(topics_page_scope) @topic_views = @topics_page_scope.with_read_and_follow_states(user).map do |(topic, read_state, follow)| topic_view_class.new(topic, read_state, follow, Pundit.policy!(user, topic)) end end |