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?
Also, is there a way to clean up the last 4 routes?
I completely invented map.index because i didn’t know how to see my
resurces listing in /, instead of typing /resources.
(i am sorry for the mess made by my resources controller, but i really
needed to call it like this :D)
Here are my routes.
[code=]ActionController::Routing::Routes.draw do |map|
map.resources :categories
map.resources :resources
map.namespace :admin do |admin|
admin.resources :resources
admin.resources :categories
end
map.resources :users
map.resource :session, :controller => ‘sessions’
map.signup ‘/signup’, :controller => ‘users’, :action => ‘new’
map.login ‘/login’, :controller => ‘sessions’, :action => ‘new’
map.logout ‘/logout’, :controller => ‘sessions’, :action => ‘destroy’
map.index ‘/’, :controller => ‘resources’, :action => ‘index’
end[/code]
Thank You in advance!