User profile page setup
This commit is contained in:
parent
2560f2e4f7
commit
7fc05d6c9c
|
@ -56,6 +56,11 @@ nav {
|
|||
}
|
||||
}
|
||||
|
||||
main {
|
||||
max-width: 100em;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
a:link, a:visited {
|
||||
color: var(--highlight-color);
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ class UsersController < ApplicationController
|
|||
end
|
||||
|
||||
def show
|
||||
@user = User.find(params[:id])
|
||||
@user = User.find_by(username: params[:id])
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -1 +1,3 @@
|
|||
<%= @user.username %>
|
||||
<h2><%= @user.username %></h2>
|
||||
<h4><%= @user.full_name %></h4>
|
||||
|
||||
|
|
Loading…
Reference in New Issue