A
A
Andrey2016-12-14 15:50:19
Ruby on Rails
Andrey, 2016-12-14 15:50:19

How to link /profile?

There is a User model and a Profile model nested in it.
When entering the profile, the following link is displayed - /profile.id (/profile.2 or profile.10)
To edit the profile - /profile/edit.id
How to get rid of the id at the end? and change the url to /username
Tried through to_param - it doesn't work.
In routesresource :profile
9185eba85f8840c6a1674eb0e177d9a9.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton, 2016-12-14
@hummingbird

Route list:
User login in URL:
But be aware of possible conflicts with other paths.
In general, check out this: guides.rubyonrails.org/routing.html

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question