Skip to content

Instantly share code, notes, and snippets.

@Oshuma
Created November 30, 2008 07:27
Show Gist options
  • Save Oshuma/30406 to your computer and use it in GitHub Desktop.
Save Oshuma/30406 to your computer and use it in GitHub Desktop.
def create(comment)
@article = Article.get(params[:article_id])
@comment = Comment.new(comment.merge(:article => @article))
if @comment.save
redirect resource(@article), :message => {:notice => 'Your comment was saved.'}
else
redirect resource(@article), :message => {:error => 'Must fill in all fields.'}
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment