From ed2feab29839fdcab3dde8c7124b7815a605dd5b Mon Sep 17 00:00:00 2001 From: jomo Date: Sun, 29 Jun 2014 06:36:55 +0200 Subject: [PATCH] fix userlist sorting; fix idiot-check --- app/controllers/users_controller.rb | 5 ++--- app/models/user.rb | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 61adf77..4b5af22 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -11,10 +11,9 @@ class UsersController < ApplicationController @users = User.where(role: Role.get(params[:role])) end else - @users = User.all.to_a - @users.shift #Remove first user + @users = User.where.not(id: User.first.id) #Remove first user end - @users = @users.to_a.sort_by{|u| u.role}.reverse! + @users = @users.order("role_id desc", :name).to_a end def show diff --git a/app/models/user.rb b/app/models/user.rb index 611ac14..c969a08 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -89,7 +89,7 @@ class User < ActiveRecord::Base payload = { agent: { name: "Minecraft", version: 1 }, username: self.email, password: password } begin response = http.post(uri.request_uri, payload.to_json, "Content-Type" => "application/json").code - if response.code == "200" + if response == "200" return true else payload[:username] = self.ign