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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
That's wicked!