I'm building a marketplace app in Rails 4. When entering products, sellers can enter a price and a saleprice. SalePrice is optional.
My current validations below check for values greater than 0. How do I add a validation for - saleprice must be at least 5% lower than price.
validates :price, numericality: {greater_than: 0}
validates :saleprice, numericality: {greater_than: 0}, :allow_blank => true