I have an app where a product can have a regular price or a discounted price both of which are saved in two seperate columns in my database as: price and offer.
I have a controller called 'generals' which is for all general products.
What I would like to happen is that if 'general.offer' is blank then the div that wraps the price will have a class of 'product-price'. If however there is a value present in general.offer then the div will have a class of 'product-special-price'.
Currently I have the following:
#View
<div class="<%= product_price %>">
<%= general.price %>
</div>
#Application Helper
def product_price
if general.offer.blank?
return "product-price"
else
return "product-special-price"
end
end
At the moment I am receiving a wrong number of arguments error. Any advice people have on how to fix this would be much appreciated :)
undefined local variable or method general for #<#<Class:0x61fc908>:0x5dce1d8>. Thanks so much for your help!