mercredi 14 décembre 2016

Rails 3 how to validate additional columns using Rakismet gem

I am using Rakismet(1.5.3) gem in my Rails(3.2.22) project. Rakismet validates attributes such as author, author_email, author_url, content by default.

My question: I want to validate extra columns in model like post tile, post summary, post content.I tried to merge the post title, post content and post summary and assigned to content field.

post.rb

include Rakismet::Model
belongs_to :user

rakismet_attrs  :author => proc { user.full_name }, 
                :author_email => proc { user.email }
                :content => :post_detail

def post_detail
  "#{title} #{summary} #{content}"
end   

It didn't work as expected viz didn't throw any spam errors even though title, content and summary had spam text(viagra-test-123)

Please guide me to resolve this. Thank you.

Aucun commentaire:

Enregistrer un commentaire