Skip to content

Instantly share code, notes, and snippets.

@kevinrutherford
Created July 11, 2012 15:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevinrutherford/3091149 to your computer and use it in GitHub Desktop.
Save kevinrutherford/3091149 to your computer and use it in GitHub Desktop.
Code moved out of the adapter
namespace :cron
task :validate_models => [:environment] do
UseCases::ValidatesPostsAndComments.new.run
end
end
module UseCases
class ValidatesPostsAndComments
def run
[Post, Comment].each do |klass|
klass.all.each do |obj|
ErrorMailer.report_errors('me@example.com', obj) unless obj.valid?
end
end
end
end
end
@rubygem
Copy link

rubygem commented Jul 24, 2012

That's wicked!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment