Devguru
Rails Bad Practices #2 - using Time.now in scope

Ever wondered how to get your time-dependent scopes to act like bunch of lunatics? 

do this: 


class User < ActiveRecord::Base

 scope :active, where(:activated_at.gt => Time.now)

end

and your list of active users will stub every time you restart your app. Cool!

Of course, this great trick can’t be achieved with this:


class User < ActiveRecord::Base

 scope :active, lambda{ where(:activated_at.gt => Time.now) }

end