Skip to content

Instantly share code, notes, and snippets.

@JakeAustwick
Created October 24, 2011 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JakeAustwick/1309965 to your computer and use it in GitHub Desktop.
Save JakeAustwick/1309965 to your computer and use it in GitHub Desktop.
class CommentsController < ApplicationController
def create
picture = Picture.find(params[:picture_id])
@comment = picture.comments.new(params[:comment]))
if @comment.save
flash[:success] = "Your comment has been added."
redirect_to picture_path(picture)
else
@title = "Gallery Detail"
render PREVIOUS PAGE HERE WITH ERROR
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment