How can I modify the price before it is returned from the model?
In Ruby on Rails (v4) I want to be able to discount the price via a method
in the model. I have Tags with rules that are applied to product. For
example, if a product has two tags and one says to discount the product
$10 and the second rule says to discount the product $3, I need to be able
to set the price for the product to the lower of the two rules.
So my question is: Can I override the @product.price method with a custom
method that will allow me to apply my Tag rules first?
No comments:
Post a Comment