[REST] change :controller/:id/:action to :controller/:title/

Ok, so this is the very very first time i use Ruby on Rails.

I’m developing a simple resource listing application

My question in simple: now to see a resource i would goto /resources/:id i want this to change to /resources/:permalink, with permalink being a

field in my resources table. How do i accomplish that?

This might help: http://www.railscasts.com/episodes/63

Also, is there a way to clean up the last 4 routes?

Use map.with_options :controller => “sessions” do |page| page.login “/login”, :action => “new”

page.logout "/logout", :action => 'destroy'

end

I completely invented map.index because i didn’t know how to see my resurces listing in /, instead of typing /resources.

If you are using Rails 2.0, you can use map.root . From the docs:

Use map.root as a shorthand to name a route for the root path “”.

# In routes.rb
  map.root :controller => 'blogs'

  # would recognize [http://www.example.com/](http://www.example.com/) as
  params = { :controller => 'blogs', :action => 'index' }

  # and provide these named routes
  root_url # => '[http://www.example.com/](http://www.example.com/)'
  root_path # => ''