Method: MongoidForums::TopicsController#show

Defined in:
app/controllers/mongoid_forums/topics_controller.rb

#showObject



7
8
9
10
11
12
13
14
15
16
17
18
# File 'app/controllers/mongoid_forums/topics_controller.rb', line 7

def show
  if find_topic
    register_view

    @posts = @topic.posts.order_by([:created_at, :asc])
    @posts = @posts.page(params[:page]).per(MongoidForums.per_page)

    if mongoid_forums_user.present?
      Alert.where(user_id: mongoid_forums_user.id, read: false, subscription_id: Subscription.where(subscribable_id: @topic.id, subscriber_id: mongoid_forums_user.id).first).update_all(:read => true, :ready_at => Time.now)
    end
  end
end