Skip to content

Instantly share code, notes, and snippets.

@alovak
Created June 25, 2012 10:15
Show Gist options
  • Save alovak/2987785 to your computer and use it in GitHub Desktop.
Save alovak/2987785 to your computer and use it in GitHub Desktop.
active record two stage validation
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