Custom URLs in Ruby on Rails: How you can use descriptive slugs instead of ids

Custom URLs in Ruby on Rails: How you can use descriptive slugs instead of ids

6 years ago
Anonymous $hM_jrxqbr-

https://medium.freecodecamp.org/custom-urls-in-ruby-on-rails-use-descriptive-slugs-instead-of-ids-67c631475a94

When you browse the web, you usually see URLs that are descriptive of the page you are going to. For example Medium’s blog post URLs are formed by the title of the post. Using Ruby on Rails resources for your routing defaults to finding models by their ids. This post will show you how to change this to route and find a model’s URL.

Change an id-based URL like this:

Custom URLs in Ruby on Rails: How you can use descriptive slugs instead of ids

Jul 23, 2018, 3:17am UTC
https://medium.freecodecamp.org/custom-urls-in-ruby-on-rails-use-descriptive-slugs-instead-of-ids-67c631475a94 > When you browse the web, you usually see URLs that are descriptive of the page you are going to. For example Medium’s blog post URLs are formed by the title of the post. Using Ruby on Rails resources for your routing defaults to finding models by their ids. This post will show you how to change this to route and find a model’s URL. > Change an id-based URL like this: