Created
September 4, 2015 20:01
-
-
Save paulmars/6f04b6a2caf5c3879e1f to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class Val | |
| def self.check!(klass) | |
| klass.find_each do |s| | |
| begin | |
| if !s.valid? | |
| message = s.errors.full_messages.to_sentence | |
| throw "#{klass.to_s} #{s.id} #{message}" | |
| end | |
| rescue => e | |
| Raven.capture_exception(e) | |
| end | |
| end; true | |
| end | |
| end |
This file contains hidden or 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
| class ValidationWorker | |
| def perform | |
| # do all your records | |
| Val.check!(User) | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment