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 7548675
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:45:34+00:00 2026-05-30T09:45:34+00:00

I want to have the users index page to list the admin and normal

  • 0

I want to have the users index page to list the admin and normal users separately, the below where you can select the Student or Admin view, via what I’d presume would be links…

Index view for users…

<h1>Listing users</h1>

<p><b><u>Students</u></b> <u>Admins</u></p>

<table>
  <tr>
    <th>Email</th>
    <th>Login count</th>
  </tr>

<% @users.each do |user| %>
  <tr>
    <td><%= user.email %></td>
    <td><%= user.login_count %></td>
  </tr>
<% end %>
</table>

<p><%= link_to 'New User', new_admin_user_path %></p>

In my Users controller

class Admin::UsersController < ApplicationController
    before_filter :require_admin_user

    def index
      # @users = User.admin 
      @users = User.students.paginate page: params[:page], order: 'created_at desc', per_page: 20

      respond_to do |format|
        format.html # index.html.erb
        format.json { render :json => @users }
      end
    end

Is this possible?

  • 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-05-30T09:45:35+00:00Added an answer on May 30, 2026 at 9:45 am

    If you’re set on having two different tables for the two then doing another view would be the easiest way. The top links could be just how you want them.

    <p><b><u><%= link_to 'Students', user_path %></u></b> <u><%= link_to 'Admin', admin_path %></u></p>
    

    Is there a reason you’re set against having a table combining all users and then a column to differentiate if they’re an admin? That would make it a lot easier to do what you’re looking for.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an index view that I want to update automatically as the user
I'm new to using SugarCRM. I want to have a users page that does
I have users table and want to SELECT some rows by bitmask criteria. I'll
i have users table and i have posts table i want select from users
I have an index page which shows a paged list of data from a
I have a dropdown select list on my page of class=TypeFilter. I have a
i try to solve a problem. i have an index page and users enter
I have an index view that lists items, and it's a long list so
Is there any way we can list multiple models in one index page? Like
I have a Edit View generated by VS 2010 (code below). I don't want

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.