Hierarchical URLs

Hi!

I have two models, artists and songs. Each artist has, of course, many
songs and each song belongs to one artist. Everything is working fine
but I want to make my urls look a bit different. I’m very new to Ruby
and RoR.

Right now my urls looks like this:
example.com/artists/1 #Listing all of the songs that is related to
this artist
example.com/songs/1 #Showing a song

What I want is something like this:
example.com/music/artist_name/song_name-id

I have tried to find info about this but I don’t really know what to
search for.

Best Regards
Linus

Ah!

Found this video at Railscasts (of course… :slight_smile: )
http://media.railscasts.com/videos/203_routing_in_rails_3.mov

Regards
Linus

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs