normalizr
normalizr copied to clipboard
Model method to normalize input values
I'd like to have a class method such as normalize_values
that does something like this:
input = {product_code: " ABC123 "}
clean_input = Product.normalize_values(input)
#=> {product_code: "ABC123"}
Product.where(clean_input)
This would effectively build a new model instance to push values through the normalizer, and read them back. Is that within scope of your gem for a pull request?
Yeah, it can be useful. But I guess it will be quite complicated to implement.