On Friday, July 19, 2013 1:47:37 PM UTC+1, James Coleman wrote:

Particularly given that relations are already themselves proxies that 
> generally quack like arrays but lazily-load items. The `all` method is 
> specifically there so that you can *break out* *of that proxy*.
>

As of Rails 4, Model.all returns an ActiveRecord::Relation, not an array - 
that now requires a specific call to to_a on a Relation.

This being the case, how about allowing array-like syntax equivalent to 
both offset andlimit methods? I’d quite like e.g.:

Item[0] == Item.limit(1)Item.all[2..4] == Item.offset(2).limit(2)Item.all[4,4] 
== Item.offset(4).limit(4)Item.order(:size)[5,10] == 
Item.order(:size).offset(5).limit(10)

... and so on. Don't think that conflicts with any other syntax? 

Happy to PR if anybody likes this.

-Matt
 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to