I am trying to get my console to print the total cost of all my Locations tariff cards.
I am trying to complete this task through the console, but as a result I get BigDecimal. Stuck on how to convert this result to a human-readable string or integer.
Results:
Location.pluck(:rate_card).sum => "#<BigDecimal:7f7cf347edd0,'0.3091675E6',18(36)>"
In my "index" location, to see the dollar amount, I have this setting as:
<%= number_to_currency(location.rate_card, :precision => 2) %>
TIA
count console sum ruby-on-rails-4
RubyNewbie
source share