jnunemaker/mongomapper — Issue #380: different result from scoped query with ActiveRecord
Author: yosiyuki
Created: 2012-01-19 01:13:23+00:00
State: open

by the following scope notation, ActiveRecord and MongoMapper returns different result in production environments.

```ruby
class Article < xxxx(MM or AR)
scope :recent, where("created_at > ?", Time.now)
scope :recent_by_block, lambda { where("created_at > ?", Time.now) }
end
```

With ActiveRecord,

* scope#recent returns articles created after web server restarted (precisely, the first time scope#recent is called).
* scope#recent_by_block returns no articles (since no record will be created after "now")

With MongoMapprt,

* both of scopes returns articles created after web server restarted (same as scope#recent in AR)

Though I'm not sure if this behavior is required in both of ORMs, my opinion is MM should follow the behavior of AR.