app/controllers/users_controller.rb
def edit
    @user = User.find(params[:id])
    if @user.id != session[:user_id] && current_user.role != 'admin' && current_user.role != 'moderator'
      redirect_to '/users'
    end
  end
# user can edit users, but this guarentees the user can only
# edit their own information
user can edit users, but this guarentees the user can only
edit their own information
user can edit users but this guarentees the user can only edit their own information
def edit
    @user = User.find(params[:id])
    if @user.id != session[:user_id] && current_user.role != 'admin' && current_user.role != 'moderator'
      redirect_to '/users'
    end
  end
def edit @user = User . find ( params [ :id ] ) if @user . id != session [ :user_id ] && current_user . role != 'admin' && current_user . role != 'moderator' redirect_to '/users' end end
user can edit users, but this guarentees the user can only
edit their own information
user can edit users but this guarentees the user can only edit their own information