Question

The date_validator in its examples has a comment:

Using Proc.new prevents production cache issues

Does it mean, that everywhere in my code, where I use current time related methods (Time.now, 1.day.since(Time.zone.now), etc.) I should surround them with Proc.new { }?

I don't completely understand this, since replacing

time_now = Time.now.utc

with

time_now = Proc.new { Time.now.utc }

just doesn't make sense to me (new type of object is returned).

So, the question is, when and how should I use Proc.new with time related methods? And does that still apply to the latest versions of Ruby (1.92) and Rails (3.1)?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top