Maybe you forgot to use a block in your scope (in that case the Time.now is
evaluated only 1 time in production, at the moment the class is loaded, not at
the time the scope is called). ?
From
<quote>
Note that scopes defined with scope will be evaluated when they are defined, rather than when they are used. For example, the following would be incorrect:
class Post < ActiveRecord::Base
scope :recent, where('published_at >= ?', Time.now - 1.week)
end
The example above would be ‘frozen’ to the Time.now value when the Post class was defined, and so the resultant SQL query would always be the same. The correct way to do this would be via a lambda, which will re-evaluate the scope each time it is called:
class Post < ActiveRecord::Base
scope :recent, lambda { where('published_at >= ?', Time.now - 1.week) }
end
</quote>
HTH,
Peter