帖子增加所属目录参数

dev_home
cxt 5 years ago
parent 4a64c3de74
commit 8bed49e385

@ -31,7 +31,7 @@ class MessagesController < ApplicationController
else messages.order("created_on #{sort}")
end
messages = messages.includes(:author)
messages = messages.includes(:author, :board)
@messages = Kaminari.paginate_array(messages).page(@page).per(@page_size)
ids = @messages.map(&:id)

@ -7,7 +7,8 @@ json.data do
json.messages do
json.array! @messages do |message|
json.extract! message, :id, :parent_id, :subject, :created_on, :total_replies_count,
:praises_count, :visits, :sticky, :is_hidden, :is_public
:praises_count, :visits, :sticky, :is_hidden, :is_public, :board_id
json.category_name message.board&.name
json.total_praises_count @praises_count_map.fetch(message.id, 0)

Loading…
Cancel
Save