blob: bd255adf07d4589f23933430dcc6087d4140ce64 (
plain) (
blame)
| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 | class Admin::CommentsController < Admin::AdminController
  before_action :set_section
  def index
    @comments = Comment.order(updated_at: :desc).paginate(page: params[:page], per_page: 20)
  end
  def destroy
    if Comment.destroy(params[:id])
      flash.notice = "Comment successfully deleted."
    else
      flash.alert = "Could not delete comment."
    end
    redirect_to admin_comments_url
  end
  private
    def set_section
      @section = "comments"
    end
end
 |