Creating a `Users` show page using Devise

You should generate a users_controller which inherits from application_controller and define there your custom show method. Don’t forget to create a view and routes for it.
Ex:

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

#in your view
<%= @user.name %>

#routes.rb
match 'users/:id' => 'users#show', via: :get
# or 
get 'users/:id' => 'users#show'
# or
resources :users, only: [:show]

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)