1

I'm currently using the Rakismet gem for anti spam in my app and it's doing a great job filtering out certain buzz words like "viagra" and "porn", but it's not flagging duplicate comments no matter how many times I submit them.

My Post model has the line "include Rakismet::Model" and it's getting info from the author_email and content db columns. How can I get this to work? Code examples would be greatly appreciated. Ideally I'd like to filter the comment even if they change a few characters. Thanks!

Edit

I was able to solve exact duplicates with the following in my create action, but I'd still like to solve the problem of few character changes (where it would not be an exact duplicate and therefore still be posted)

if @post.spam? == true
  redirect_to :back
  return
else
  if current_user.posts.last.content == @post.content
     redirect_to :back
  return
  else
  @post.save
  redirect_to :back
  return
  end
ahuang7
  • 804
  • 1
  • 11
  • 26

0 Answers0