Created
July 11, 2012 15:31
-
-
Save kevinrutherford/3091149 to your computer and use it in GitHub Desktop.
Code moved out of the adapter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :cron | |
task :validate_models => [:environment] do | |
UseCases::ValidatesPostsAndComments.new.run | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
That's wicked!