normalizr icon indicating copy to clipboard operation
normalizr copied to clipboard

Model method to normalize input values

Open avit opened this issue 8 years ago • 1 comments

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?

avit avatar Apr 26 '16 14:04 avit

Yeah, it can be useful. But I guess it will be quite complicated to implement.

dmeremyanin avatar May 23 '16 21:05 dmeremyanin