DEVISE LIST USERS - RaulArgott/Library_Ruby GitHub Wiki

For devise 4.7.1 and Rails 5.1.7

Index and Listing Users

Creating Users controller Execute the command rails -g Users controller

Creating index method

Listing non admin users @users = User.where(admin: false)

or listing all users @users = User.all

Creating index file

Create index.html.erb file inside users/views directory

Routing index

In routes.rb diles add this line match '/users', to: 'users#index', via: 'get'

Show users registered on devise

Add this lines to the index.html.erb file

<% @users.each do |user| %>

<%= user.email %>

<% end %>

⚠️ **GitHub.com Fallback** ⚠️