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