Class: Interact::Admin::CommentsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/interact/admin/comments_controller.rb

Instance Method Summary collapse

Instance Method Details

#destroyObject



24
25
26
27
# File 'app/controllers/interact/admin/comments_controller.rb', line 24

def destroy
  @comment.destroy
  redirect_to comments_url, notice: 'Comment was successfully destroyed.'
end

#editObject



13
14
# File 'app/controllers/interact/admin/comments_controller.rb', line 13

def edit
end

#indexObject



4
5
6
7
8
# File 'app/controllers/interact/admin/comments_controller.rb', line 4

def index
  q_params = {}.with_indifferent_access
  q_params.merge! params.permit(:commentable_type, :commentable_id)
  @comments = Comment.default_where(q_params).page(params[:page])
end

#showObject



10
11
# File 'app/controllers/interact/admin/comments_controller.rb', line 10

def show
end

#updateObject



16
17
18
19
20
21
22
# File 'app/controllers/interact/admin/comments_controller.rb', line 16

def update
  if @comment.update(comment_params)
    redirect_to comments_url, notice: 'Comment was successfully updated.'
  else
    render :edit
  end
end