This is my Taletids table:
Price (integer)
Price2(integer)
In my view I have:
@taletids = Taletid.where(:online => true).order('position')
But I want to multiply the price column with 2.
And add a “fake” column to the @taletids array sum with is the sum of the Price2 multiplied with 2 (params[:tal]) and the Price column.
So that I can call the sum in view as this:
<% @taletids.each do |tale| %>
<%= tale.sum %>
<% end %>
You could add a method to your Taletids model representing sum: