53 lines
555 B
Ruby
53 lines
555 B
Ruby
# -*- encoding : utf-8 -*-
|
|
|
|
class Admin::CommentsController < ApplicationController
|
|
|
|
before_filter :authenticate_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[:comment])
|
|
|
|
|
|
else
|
|
|
|
render :action => "edit"
|
|
|
|
end
|
|
end
|
|
|
|
|
|
def destroy
|
|
|
|
@comment = Comment.find(params[:id])
|
|
@comment.destroy
|
|
|
|
end
|
|
|
|
|
|
def find_comments
|
|
@comments = Comment.all
|
|
end
|
|
|
|
end
|