Files
mapknitter/app/controllers/users_controller.rb
Jeffrey Warren af3552012d Cleanup (#313)
* initial cleanup

* export unit tests, basic

* map tests

* basic comment tests

* cleanup

* export functional tests

* fixes

* Update export.rb

* test fixes and further cleanup

* extra test

* trying again

* another unit test

* output errors?

* Update map_test.rb

* Update maps.yml

* Update tag_test.rb
2019-01-30 09:15:12 -05:00

21 lines
570 B
Ruby

class UsersController < ApplicationController
def profile
params[:id] = current_user.login if logged_in? && params[:id] == 0
@user = User.find_by_login(params[:id])
@maps = Map.where(user_id: @user.id)
.paginate(:page => params[:page], :per_page => 24)
end
def index
@title = "Prolific map authors"
@users = User.joins(:maps)
.select("users.*, count(users.id) as maps_count")
.group("maps.user_id")
.order("maps_count DESC")
.paginate(:page => params[:page], :per_page => 24)
render "users/index"
end
end