rails/rails — pull request #6695 by kennyj (2012-06-10 15:04:59+00:00)
Title: Fix #6635. We should call Scoping methods, before calling Array methods.

If You've the following model

```ruby
class Post < ActiveRecord::Base
scope :since, Proc.new { where('written_on >= ?', Time.now - 1.day) }
scope :to, Proc.new { where('written_on <= ?', Time.now) }
end
```

and you call `Post.since.to`, we get an exception.

Because `since` method return ActiveRecord::Relation instance, and this class's method_missing call Array's method firstly.
Thus ActiveRecord::Relation#to is same to Array#to, we get an exception.