Skip to content

Instantly share code, notes, and snippets.

@maletor
Created April 19, 2010 18:15
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 maletor/371385 to your computer and use it in GitHub Desktop.
Save maletor/371385 to your computer and use it in GitHub Desktop.
include Rakismet::Controller
rakismet_filter :only => :create
def create
@post = Post.find(params[:post_id])
@comment = @post.comments.build(params[:comment])
if @comment.spam?
flash[:error] = "This comment looks a lot like spam."
render :template => 'posts/show', :layout => 'posts'
else
if @comment.save
flash[:notice] = "Comment posted successfully."
redirect_to @post
else
render :template => 'posts/show', :layout => 'posts'
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment