Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

Commit

Permalink
add show page
Browse files Browse the repository at this point in the history
  • Loading branch information
victorloo committed Jan 31, 2018
1 parent e2b0837 commit 0eb05d8
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/controllers/users_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,8 @@ def index
@users = User.all
end

def show
@user = User.find(params[:id])
end

end
16 changes: 16 additions & 0 deletions app/views/users/show.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<h1>User Profile</h1>

<table>
<tr>
<th>Name: </th>
<td>
<%= @user.name %>
</td>
</tr>
<tr>
<th>Role: </th>
<td>
<%= @user.role %>
</td>
</tr>
</table>
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@
# For details on the DSL available within this file, see http://guides.rubyonrails.org/routing.html

root "users#index"
resources :users
end

0 comments on commit 0eb05d8

Please sign in to comment.