diff options
Diffstat (limited to 'users/app/controllers')
-rw-r--r-- | users/app/controllers/users_controller.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/users/app/controllers/users_controller.rb b/users/app/controllers/users_controller.rb index 4912ac8..925b584 100644 --- a/users/app/controllers/users_controller.rb +++ b/users/app/controllers/users_controller.rb @@ -8,7 +8,13 @@ class UsersController < ApplicationController respond_to :json, :html def index - @users = User.all + if params[:query] + @users = User.by_login.startkey(params[:query]).endkey(params[:query].succ) + else + @users = User.by_created_at.descending + end + @users = @users.limit(10) + respond_with @users.map(&:login).sort end def new |