Well there's one benefit of having it defined in the routes.rb now --
you have nice helper methods for the URL's :-)
Some suggests:
# Pluralize your routes
----------------
ActionController::Routing::Routes.draw do |map|
map.namespace :info do |info|
info.resources :citations
info.resources :downloads
info.resources :links
info.resources :recommendations
end
# Install the default routes as the lowest priority.
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'
end
-----------
# Pluralize your controller
class Info::LinksController < ApplicationController
def index
@title = "LINKS"
end
end
# Use a helper method for the url
---------
<li><%= link_to "Links", info_links_path %></li>
---------
You can see what routes have been defined by executing the following
rake command in your application:
$ rake routes
May I suggest you read up on Restful routing on the Rails Guide
(free):
http://guides.rails.info/routing.html#restful-routing-the-rails-default
Peepcode also has a great screencast on the subject (not free):
http://peepcode.com/products/rest-for-rails-2
Cheers!
Nicholas
On Jun 15, 6:47 pm, zambezi <[email protected]> wrote:
> Thanks to Nicholas Henry and Sijo Kg for responding.
>
> Having to add the routes to the routes.rb file still seems a
> cumbersome approach, but so be it. Unfortunately it isn't working as
> I raise a Routing Error ( No route matches "/link" with
> {:method=>:get} ) with the following configuration
>
> ----------------
> ActionController::Routing::Routes.draw do |map|
> map.namespace :info do |info|
> info.resources :citation
> info.resources :download
> info.resources :link
> info.resources :recommendation
> end
> # Install the default routes as the lowest priority.
> map.connect ':controller/:action/:id'
> map.connect ':controller/:action/:id.:format'
> end
>
> -----------
> class Info::LinkController < ApplicationController
> def index
> @title = "LINKS"
> end
> end
> ---------
> <li><%= link_to "Links", {:controller =>'link', :action =>'index' }
> %></li>
> ---------
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---