diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 3e74dea..3b9390c 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -1,2 +1,9 @@ class UsersController < ApplicationController + def show + @user = User.find(params[:id]) + end + + def index + @users = User.all + end end diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb new file mode 100644 index 0000000..f673952 --- /dev/null +++ b/app/views/users/index.html.erb @@ -0,0 +1,20 @@ +

Users

+ + + + + + + + + + + <% @users.each do |user| %> + + + + + + <% end %> + +
IDNameBalance
<%= user.id %><%= user.name %><%= user.balance %>
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb new file mode 100644 index 0000000..6719a08 --- /dev/null +++ b/app/views/users/show.html.erb @@ -0,0 +1,28 @@ +

<%= @user.name %>

+ + + + + + + + + + + + + + + <% @user.transactions.each do |transaction| %> + + + + + + + + + + <% end %> + +
IDDebtorCreditorAmountOriginMessageTime
<%= transaction.id %><%= transaction.debtor.name %><%= transaction.creditor.name %><%= transaction.amount %><%= transaction.origin %><%= transaction.message %><%= transaction.created_at %>
diff --git a/config/routes.rb b/config/routes.rb index c800bae..c5ca861 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -5,6 +5,8 @@ Rails.application.routes.draw do root to: 'high_voltage/pages#show', id: "landing" + resources :users, only: [:show, :index] + # The priority is based upon order of creation: first created -> highest priority. # See how all your routes lay out with "rake routes".