Files
danbooru/app/controllers/comments_controller.rb
albert 23656e3fa9 * Continued work on improving post view templates
* Added statistics-based estimator for related tag calculator
* Fleshed out IpBan class based on changes to Danbooru 1.xx
2010-04-29 17:32:15 -04:00

28 lines
651 B
Ruby

class CommentsController < ApplicationController
respond_to :html, :xml, :json
def index
end
def update
@comment = Comment.find(params[:id])
@comment.update_attributes(params[:comment])
respond_with(@comment)
end
def create
@comment = Comment.new(params[:comment])
@comment.post_id = params[:comment][:post_id]
@comment.creator_id = @current_user.id
@comment.ip_addr = request.remote_ip
@comment.score = 0
@comment.save
respond_with(@comment) do |format|
format.html do
flash[:notice] = "Comment posted"
redirect_to posts_path(@comment.post)
end
end
end
end