Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link

@rubygem 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