Rails 5 - Create vanity route for each instance of model
问题 I know there has to be a cleaner way of doing this but I haven't written code in a while and am drawing a blank. I have a model called Link that has a Title, Slug and Destination. Destination is the location to redirect (mydomain.com/instagram would redirect to my instagram account). Slug is to customize the slug for friendly_id. This is the code in my routes.rb and it works but it feels gross. Link.all.each do |link| get "/#{link.slug}", to: 'links#show', :id -> link.id end Is there a better