idn_app/app/controllers/admin/comments_controller.rb
2016-07-29 20:23:40 +02:00

53 lines
587 B
Ruby
Executable File

# -*- encoding : utf-8 -*-
class Admin::CommentsController < ApplicationController
before_filter :auth_admin
layout "admin"
before_filter :find_comments
def index
end
def edit
@comment = Comment.find(params[:id])
end
def update
@comment = Comment.find(params[:id])
if @comment.update_attributes(params.require(:comment).permit!)
else
render :action => "edit"
end
end
def destroy
@comment = Comment.find(params[:id])
@comment.destroy
end
def find_comments
@comments = Comment.order("created_at DESC").all
end
end