Skip to content

Commit

Permalink
Merge pull request #71 from assemblymade/analyze_spam_fix
Browse files Browse the repository at this point in the history
Ensure that the spammable class is formatted correctly
  • Loading branch information
just3ws committed Jul 19, 2014
2 parents b9fe0f8 + 3c61d76 commit 3d7e5e8
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions app/jobs/analyze_spam.rb
Expand Up @@ -5,19 +5,15 @@ class AnalyzeSpam < Struct.new(:spammable)

def perform

ap(spammable) unless Rails.env.test?

spammable.symbolize_keys!

thing_to_analyze = spammable[:klass].constantize.find(spammable[:id])

ap(thing_to_analyze) unless Rails.env.test?
thing_to_analyze = spammable[:klass].classify.constantize.find(spammable[:id])

if thing_to_analyze.spam?
puts("#{spammable[:klass]} with id #{spammable[:id]} was spam") unless Rails.env.test?
puts("#{spammable[:klass]} with id #{spammable[:id]} was spam") if ENV['DEBUG']
thing_to_analyze.create_spam_report
else
puts("#{spammable[:klass]} with id #{spammable[:id]} was NOT spam") unless Rails.env.test?
puts("#{spammable[:klass]} with id #{spammable[:id]} was NOT spam") if ENV['DEBUG']
end
end
end

0 comments on commit 3d7e5e8

Please sign in to comment.