Skip to content

Commit

Permalink
Ensure that the spammable class is formatted correctly before constan…
Browse files Browse the repository at this point in the history
…tizing. Cleaned out the old logging noise
  • Loading branch information
just3ws committed Jul 19, 2014
1 parent b9fe0f8 commit 3c61d76
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 3c61d76

Please sign in to comment.