0

I am developing an application for reporting and analytic,where I need to generate data on a daily basis and put it in a CSV.To be more clear, if I take the report today like day one any how I can get the report thats already done, if I get the report tomorrow I should be able to get the data of today,yesterday. If i take after 4 days I should get the report starting from day 1 to day 4.

How it can be done. Looking for heads up

Jeevan Dongre
  • 4,627
  • 13
  • 67
  • 129

1 Answers1

1

How about this:

today = Date.today
tomorrow = today.next
four_days_ago = 4.days.ago(today)
four_days_later = 4.days.since(today)
(today..(4.days.since(today)).each {|d| puts d}
Yanhao
  • 5,264
  • 1
  • 22
  • 15