So for example, if I give like this
map.root :controller => "pages", :action => 'show', :slug => "**homepage**"
map.connect '*slug', :controll开发者_运维问答er => 'pages', :action => 'show'
what will happen?
Have you run either rake routes
or read the routing guides? Perhaps these will aid you.
From what I can deduce from your statement, map.root will just set the url root, "http://www.abc.com/", to automatically redirect to the "pages" controller and execute the "show" method and the slug is a human-readable id for that root.
From best I can tell, I am still a bit of a n00b in Rails, the connect statement will assign the pages controller and show action to all urls that end in "slug" within the root. For example, "http://www.abc.com/firstslug" would route to "/pages/show".
精彩评论