Created
March 14, 2010 08:35
-
-
Save anonymous/331860 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class CommentsController < ApplicationController | |
def index @account = Account.find(params[:account_id]) @comments = @account.comments | |
end | |
def show @account = Account.find(params[:account_id]) @comment = @account.comments.find(params[:id]) | |
end | |
def new @account = Account.find(params[:account_id]) @comment = @account.comments.build | |
end | |
def create @account = Account.find(params[:account_id]) @comment = @account.comments.build(params[:comment]) | |
if @comment.save redirect_to post_comment_url(@account, @comment) | |
else render :action => "new" | |
end | |
end | |
def edit @account = Account.find(params[:account_id]) @comment = @account.comments.find(params[:id]) | |
end | |
def update @account = Account.find(params[:account_id]) @comment = Comment.find(params[:id]) | |
if @comment.update_attributes(params[:comment]) redirect_to post_comment_url(@account, @comment) | |
else render :action => "edit" | |
end | |
end | |
def destroy @account = Account.find(params[:post_id]) @comment = Comment.find(params[:id]) @comment.destroy respond_to do |format| format.html { redirect_to post_comments_path(@post) } format.xml { head :ok } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment