I need to fetch last products price through console in Spree
Spree::Product.last.price
=> #<BigDecimal:850ff20,'0.3394E4',9(18)>
In the returned value given above, .3994 is shown, 3994 is the real price. How to return the exact price from the product or how can I parse the above price of this product from "BigDecimal:850ff20,'0.3394E4',9(18)" to "3394"
"0.3394E4" means "3394". If all you want from it is to read it in the console, just call .to_f
on it, for instance.