A date cannot immediately become an integer. Example:
$ Date.today => #<Date: 2017-12-29 ((2458117j,0s,0n),+0s,2299161j)> $ Date.today.to_i => NoMethodError: undefined method 'to_i' for
Your options: either include a date and then Int, which will give you seconds from an era:
$ Date.today.to_time.to_i => 1514523600
Or come up with some other number you want, like days from an era:
$ Date.today.to_time.to_i / (60 * 60 * 24) Number of days since epoch
Nilla Dec 29 '17 at 20:25 2017-12-29 20:25
source share