AdamM
AdamM

Reputation: 183

Sort alphabeticaly and limit

I have problem with sorting users by name and getting next item. How to get users with name < "Alf" i.e. users with names "Big", "Bob","Rob" etc. ? And for another example name < "Big", so users with names "Bob","Rob" will get selected.

How can I get sorted users by name with where query applied?

Upvotes: 0

Views: 45

Answers (1)

ray
ray

Reputation: 5552

Try following,

User.where('name > ?', 'Big').order(:name)

Upvotes: 1

Related Questions