Skip to content

Instantly share code, notes, and snippets.

@tkawa
Created May 14, 2012 17:11
Show Gist options
  • Save tkawa/2695123 to your computer and use it in GitHub Desktop.
Save tkawa/2695123 to your computer and use it in GitHub Desktop.
# skip validates (summary)
class SomeModel < ParentModel # < ActiveRecord::Base
_callback = _validate_callbacks.find {|c|
c.raw_filter.is_a?(ActiveModel::Validations::InclusionValidator) && # class name
c.raw_filter.instance_variable_get(:@attributes).try(:include?, :attribute_name) }
skip_callback(:validate, _callback.kind, _callback.filter)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment