User profile page setup

This commit is contained in:
Trevor Vallender 2023-08-18 17:45:38 +01:00
parent 2560f2e4f7
commit 7fc05d6c9c
4 changed files with 17 additions and 2 deletions

View File

@ -56,6 +56,11 @@ nav {
}
}
main {
max-width: 100em;
margin: 0 auto;
}
a:link, a:visited {
color: var(--highlight-color);
}

View File

@ -17,7 +17,7 @@ class UsersController < ApplicationController
end
def show
@user = User.find(params[:id])
@user = User.find_by(username: params[:id])
end
private

View File

@ -17,4 +17,12 @@ class User < ApplicationRecord
format: { with: /\A.*@.*\..*\z/ } # Only very basic regex
validates :password, confirmation: true
def to_param
username
end
def full_name
"#{first_name} #{last_names}"
end
end

View File

@ -1 +1,3 @@
<%= @user.username %>
<h2><%= @user.username %></h2>
<h4><%= @user.full_name %></h4>