Z
Z
Zaur Ashurbekov2017-09-30 13:47:49
Ruby on Rails
Zaur Ashurbekov, 2017-09-30 13:47:49

How to set another parameter in routing?

Hello Toaster!
How to use another unique column instead of :id in resources? And so that it would automatically get up in the path, etc.
for example, do something like "/projects/:name". And this code
link_to "Проект", @project
will give a link to
/projects/#{project.name}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Leonchik, 2017-09-30
@zaurius

If it's simple, then use the friendly_id gem

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question