Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem when validating extra attributes #45

Open
kathirvelkg opened this issue Jan 5, 2017 · 1 comment
Open

Problem when validating extra attributes #45

kathirvelkg opened this issue Jan 5, 2017 · 1 comment

Comments

@kathirvelkg
Copy link

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

class Post < ActiveRecord::Base
  include Rakismet::Model
  belongs_to :user

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

  #Virtual attribute
  def post_detail
    "#{title} #{summary} #{content}"
  end
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).
I have also tried Proc :content => proc { "#{title} #{summary} #{content}" }, but no result.

It is working only when we assign title/summary separately to rakismet's content attribute as :content => :title

@joshfrench
Copy link
Owner

There's a section on debugging responses in the docs. The only guaranteed way to trigger a spam response is to set comment_author to viagra-test-123. Adding that string to the :content field isn't guaranteed to produce a positive result.

If you think Akismet really isn't properly validating your content, you'll need to speak with them. This gem is just a bridge to their API :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants