Skip to content

Commit 4767da3

Browse files
committed
expose number of pages in PostHistory controller
1 parent fc9f889 commit 4767da3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

app/controllers/post_history_controller.rb

+5-1
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,16 @@ def post
1010
.includes(:post_history_type, :user, post_history_tags: [:tag])
1111
.order(created_at: :desc, id: :desc)
1212

13-
@history = base_query.paginate(per_page: 20, page: params[:page])
13+
per_page = 20
14+
15+
@history = base_query.paginate(per_page: per_page, page: params[:page])
1416

1517
@count = base_query.count
1618

1719
@page = params[:page].nil? ? 1 : params[:page].to_i
1820

21+
@pages = (@count.to_f / per_page).ceil
22+
1923
render layout: 'without_sidebar'
2024
end
2125
end

0 commit comments

Comments
 (0)