I am going to make this quick. Try something like: User.all[5] Rails presently runs the following query in Postgres: SELECT "users".* FROM "users" And then gets the 6th element from the array of results.
In reality, User.all[5] should be equivalent to: User.limit(1).offset(5).first in all circumstances that this addition to the query can be performed. This means that someone looking for the nth User, for example, can simply use the brackets as is idiomatic in Ruby, to perform the query which is truly desired by the user. -- 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.
