@@ -3,6 +3,14 @@ class UsersController < ApplicationController
before_action :set_user, only: [:show, :edit, :update, :destroy]
before_action :correct_user, only: [:edit, :update]
+ def index
+ respond_to do |format|
+ @users = User.all
+ format.json
+ format.html
+ end
+
def show
end
@@ -0,0 +1,26 @@
+<% provide(:title, "Users") %>
+<h1>Users</h1>
+<table width="100%" class="table table-striped table-bordered table-hover">
+ <thead>
+ <tr>
+ <th>
+ Picture
+ </th>
+ Name
+ </tr>
+ </thead>
+ <tbody>
+ <% for user in @users %>
+ <td>
+ <%= image_tag user.picture.small.url %>
+ </td>
+ <%= link_to user.name, user %>
+ <% end %>
+ </tbody>
+</table>
@@ -0,0 +1,4 @@
+json.array! @users do |user|
+ json.id user.id
+ json.name user.name
+end