Can't remember why I added this to my product model.
validates_numericality_of :qty, less_than_or_equal_to: 10, greater_than: 0
but it was causing activerecord errors when I was removing it from Qty. (ie adding it to my cart)
I thought that the validations in the model only affect records when being created (on the new / create method?)
Anyways, i removed that from my model.
Did you mean
greater_than_or_equal_to: 0 ?
The code right now wouldn't allow the quantity to ever be 0, but that seems like something you'd want to support.
hmm, ok must have missed that. I've commented out the whole thing.
Definitely, don't need an upper limit either.
hmm, maybe that's why it was in there initially. I didn't want to add a product to the inventory unless it was qty > 0. and when I went to remove all the qty from the product, it gave me that validation error.
Join 31,353+ developers who get early access to new screencasts, articles, guides, updates, and more.