Class: PostHistoryController
Instance Method Summary
collapse
#dashboard, #keyboard_tools, #upload
Instance Method Details
#post ⇒ Object
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
|
# File 'app/controllers/post_history_controller.rb', line 2
def post
@post = Post.find(params[:id])
unless @post.can_access?(current_user)
return not_found
end
@history = PostHistory.where(post_id: params[:id])
.includes(:post_history_type, :user, post_history_tags: [:tag])
.order(created_at: :desc, id: :desc)
.paginate(per_page: 20, page: params[:page])
if @post&.help_category.nil?
render layout: 'without_sidebar'
else
render 'post_history/post', layout: 'without_sidebar', locals: { show_content: false }
end
end
|
#slug_post ⇒ Object
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
# File 'app/controllers/post_history_controller.rb', line 21
def slug_post
@post = Post.by_slug(params[:slug], current_user)
if @post.nil?
return not_found
end
@history = PostHistory.where(post_id: @post.id)
.includes(:post_history_type, :user)
.order(created_at: :desc, id: :desc)
.paginate(per_page: 20, page: params[:page])
render 'post_history/post', layout: 'without_sidebar', locals: { show_content: false }
end
|