Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8275595
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T08:07:33+00:00 2026-06-08T08:07:33+00:00

So I am trying to list all the users that have registered on my

  • 0

So I am trying to list all the users that have registered on my site, but I am getting all the table data for each user on my view page.

User_controller.rb :

class UsersController < ApplicationController
    before_filter :authenticate_user!

    def index
        @users = (current_user.blank? ? User.all : User.find(:all, :conditions => ["id != ?", current_user.id]))
  end

    def show
      if params[:id].nil? && current_user
        @user = current_user
      else
        @user = User.find(params[:id])
      end
      @cereal = current_user.cereals.build if signed_in?
      @cereals = @user.cereals.paginate(page: params[:page])
  end

  def first_time
      if params[:id].nil? && current_user
        @user = current_user
      else
        @user = User.find(params[:id])
      end
  end

    def edit
        if params[:id].nil? && current_user
            @user = current_user
        else
            @user = User.find(params[:id])
        end
  end

    def profile
        @username = params[:id]
        @friends = current_user.friends || []
        @title = "User Profile for #{@username}"
        @user = User.find_by_username(@username)
        @users = User.all :conditions => ["id != ?", current_user.id]
  end 

end

User.rb(model)

class User < ActiveRecord::Base
    include Amistad::FriendModel
  mount_uploader :avatar, AvatarUploader
  has_many :cereals, dependent: :destroy

  # Include default devise modules. Others available are:
  # :token_authenticatable, :confirmable,
  # :lockable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable, :authentication_keys => [:login]


  # Setup accessible (or protected) attributes for your model
  attr_accessible :email, :password, :password_confirmation, :remember_me, :username, :login, :avatar, :avatar_cache, :remove_avatar, :firstname, :lastname, :phone, :urlname
  # attr_accessible :title, :body

  attr_accessor :login

  def self.find_first_by_auth_conditions(warden_conditions)
      conditions = warden_conditions.dup
      if login = conditions.delete(:login)
        where(conditions).where(["lower(username) = :value OR lower(email) = :value", { :value => login.downcase }]).first
      else
        where(conditions).first
      end
    end

            def update_with_password(params={})
        current_password = params.delete(:current_password)

        if params[:password].blank?
          params.delete(:password)
          params.delete(:password_confirmation) if params[:password_confirmation].blank?
        end

                result = if params[:password].blank? || valid_password?(current_password) 
          update_attributes(params)
        else
          self.attributes = params
          self.valid?
          self.errors.add(:current_password, current_password.blank? ? :blank : :invalid)
          false
        end

        clean_up_passwords
        result
      end
    end

Views/users/index:

= @users.each do |user|
    %li
        = user.username

Anyone have any idea why when I open the index page for users, everything from the user table in the database is being displayed?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T08:07:34+00:00Added an answer on June 8, 2026 at 8:07 am

    This is after a very quick glimpse of your code, but off the top of my head try removing the = from your index view. It should be

    - @users.each do |user|
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get a list of all the users from users table and
I have an Intranet site that only registered users can watch videos. Users can
I am trying to find all users with AD that have a birthday in
I'm trying to have a GAE app that all it does is register users
I'm trying to build a form that will list all users and allow you
I'm creating a table that shows all the registered users to which the current
I'm currently trying to write a query that will return all users that have
I have a large list of users that registered through a website without any
I am trying to list all accounts that have not been logged into outside
I am trying to list all of the columns from whichever Adventureworks table I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.