Hey all,
Thanks for your time here but I am having problems with something
that should be so simple…
@campaigns = Campaign.find(:all, :conditions => [“end_date >= ?”,
Date.today])
@total_running = Campaign.sum(:impressions, :conditions => ["end_date
= ?", Date.today])
for campaign in @campaigns
campaign_days = campaign.end_date - campaign.start_date
days = days + campaign_days
end
@today = @total_running / days
So as you can see I am running two simple queries and returning
variables to the view to be displayed. Unfortunately the last line of
code here is not working and I am at a loss. When I display @today it
is giving me the values of total_running and days with a / in the
middle as if these were just strings when actually I would like the
value for total_running to be divided by days.
Example of what is displayed -
123456/51
what I would like displayed -
2420
I have tried to change the / to a + and it did correctly add the
values together and display the sum of the two values so I am at a
loss as to why it will not divide the numbers.
Thanks for the assistance.