rails/rails — Issue #5276: ActiveRecord::Base.all should be ActiveRelation...
Author: theodorton
Created: 2012-03-05 01:03:09+00:00
State: open

When working with some scopes I have I figured the `all`-method always returns an array.

The use case if you're getting your data based on a scope from `params` - and you'd like to add another scope for the data you get.

Given the following code:

```ruby
@widgets = case params[:scope] || "all"
when "enabled" then Widget.enabled
when "disabled" then Widget.disabled
when "all" then Deal.all
end.recent(10) # < Won't work when params[:scope] is "active" or nil
```

It just seems natural that any method returning data from the table should be an ActiveRelation.