Rails, for each second in past week
I want to do something for each second in the past week and pass in the current epoch time as well... I'm not sure how to do this, but it seems really trivial, here is my pse开发者_Go百科udo code:
1.week.ago..Time.now do |second|
puts second
end
How would I make this output the current time in ints for each second in that range?
How about
(1.week.ago.to_i..Time.now.to_i).each{ |second| puts "second=#{second}"}
精彩评论