Created
June 25, 2012 10:15
-
-
Save alovak/2987785 to your computer and use it in GitHub Desktop.
active record two stage validation
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
module CertoPay | |
module ActiveRecord | |
extend ActiveSupport::Concern | |
module ClassMethods | |
def validate_further(*args, &block) | |
options = args.extract_options! | |
options = options.dup | |
options[:if] = Array.wrap(options[:if]) | |
options[:if].unshift("errors.size == 0") | |
args << options | |
after_validation *args, &block | |
end | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment