Skip to content

Loading…

Ensure that the spammable class is formatted correctly #71

Merged
merged 1 commit into from

1 participant

@just3ws

Before constantizing. Cleaned out the old logging noise

@just3ws just3ws Ensure that the spammable class is formatted correctly before constan…
…tizing. Cleaned out the old logging noise
3c61d76
@just3ws just3ws merged commit 3d7e5e8 into master

2 checks passed

Details continuous-integration/travis-ci The Travis CI build passed
Details default Code Climate analyzed this pull request.
@just3ws just3ws deleted the analyze_spam_fix branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 19, 2014
  1. @just3ws

    Ensure that the spammable class is formatted correctly before constan…

    just3ws committed
    …tizing. Cleaned out the old logging noise
Showing with 3 additions and 7 deletions.
  1. +3 −7 app/jobs/analyze_spam.rb
View
10 app/jobs/analyze_spam.rb
@@ -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
Something went wrong with that request. Please try again.