Skip to content

Instantly share code, notes, and snippets.

@whitmanc
Created October 18, 2016 00:25
Show Gist options
  • Save whitmanc/35d299c2880c6e0e497317debb7f93ce to your computer and use it in GitHub Desktop.
Save whitmanc/35d299c2880c6e0e497317debb7f93ce to your computer and use it in GitHub Desktop.
Spree - Skip / exclude a model's attribute validation
Spree::Product.class_eval do
...
_validators.reject!{ |key, value| key == :shipping_category }
_validate_callbacks.each do |callback|
callback.raw_filter.attributes.reject! { |key| key == :shipping_category } if callback.raw_filter.respond_to?(:attributes)
end
...
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment