class UsersController < ApplicationController
  def create
    @user = User.new(params[:user])
    if @user.save
      redirect_to users_path
    else
      render :action => :new
    end
  end

  def edit
    @user = User.find(params[:id])
  end

  def index
    @users = User.all.sort_by(&:name)
  end

  def new
    @user = User.new
    @star = Star.new(:to => @user)
  end

  def show
    @user = User.find(params[:id])
    @star = Star.new(:to => @user)
  end

  def update
    @user = User.find(params[:id])
    if @user.update_attributes(params[:user])
      redirect_to users_path
    else
      render :action => :edit
    end
  end
end

class UsersController < ApplicationController
  def create
    @user = User.new(params[:user])
    if @user.save
      redirect_to users_path
    else
      render :action => :new
    end
  end

  def edit
    @user = User.find(params[:id])
  end

  def index
    @users = User.all
  end

  def new
    @user = User.new
    @star = Star.new(:to => @user)
  end

  def show
    @user = User.find(params[:id])
    @star = Star.new(:to => @user)
  end

  def update
    @user = User.find(params[:id])
    if @user.update_attributes(params[:user])
      redirect_to users_path
    else
      render :action => :edit
    end
  end
end

--- 
+++ 
@@ -13,7 +13,7 @@
   end
 
   def index
-    @users = User.all
+    @users = User.all.sort_by(&:name)
   end
 
   def new
Sort users list by name
