0

So I am currently trying to figure out what path to use so when the user clicks on 'View Profile' the link will be domain.com/USERNAME instead of domain.com/profiles/show

My current code for the link is

<li><%= link_to "View Profile", profiles_show_path %></li>

my routes.rb is set at

get '/:id' to: 'profiles#show'
backpackerhh
  • 2,333
  • 1
  • 18
  • 21

1 Answers1

0

You need to specify an user as parameter in your link:

<li><%= link_to "View Profile", profile_path(user) %></li>

In your routes:

get '/:id', to: 'profiles#show', as: :profile

So you're overriding the default profile_path().

backpackerhh
  • 2,333
  • 1
  • 18
  • 21