added comment edit

This commit is contained in:
albert
2011-03-08 18:26:10 -05:00
parent 2b2be3263b
commit 4af5c5c38f
3 changed files with 19 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
class CommentsController < ApplicationController
respond_to :html, :xml, :json
before_filter :member_only, :only => [:update, :create]
before_filter :member_only, :only => [:update, :create, :edit]
def index
if params[:group_by] == "post"
@@ -13,7 +13,7 @@ class CommentsController < ApplicationController
def update
@comment = Comment.find(params[:id])
@comment.update_attributes(params[:comment])
respond_with(@comment)
respond_with(@comment, :location => post_path(@comment.post_id))
end
def create
@@ -28,6 +28,11 @@ class CommentsController < ApplicationController
end
end
def edit
@comment = Comment.find(params[:id])
respond_with(@comment)
end
private
def index_by_post
@posts = Post.tag_match(params[:tags]).commented_before(params[:before_date] || Time.now).limit(8)