No route matches

i have made a top navigation.............

<div id="nav">
  <%= link_to "Home", :controller => 'welcome' %>
  &nbsp;&nbsp;
  <%= link_to "FAQ", :controller => 'faq' %>
  &nbsp;&nbsp;
  <%= link_to "Contact", :controller => 'contact' %>
  &nbsp;&nbsp;
  <%= link_to "Terms", :controller => 'terms' %>
  &nbsp;&nbsp;
  <%= link_to "Login", :controller => 'account', :action => 'login' %>
</div>

when i clik on terms or anyother link i get this error---------->

No route matches "/terms" with {:method=>:get}

and in the controller of terms
class TermsController < ApplicationController
  layout "master"
  caches_action :index
  def index
    @page_title = "Terms"
  end

end

Manish,

Post your routes.rb file so we can see how the routes are mapped.

-Danimal

Have you tried turning it off and on again?

Danimal wrote:

Manish,

Post your routes.rb file so we can see how the routes are mapped.

-Danimal

On Apr 23, 12:50 pm, Manish Nautiyal <rails-mailing-l...@andreas-

here is routes.rb------->
ActionController::Routing::Routes.draw do |map|
  # The priority is based upon order of creation: first created ->
highest priority.

  # Sample of regular route:
  # map.connect 'products/:id', :controller => 'catalog', :action =>
'view'
  # Keep in mind you can assign values other than :controller and
:action

  # Sample of named route:
  # map.purchase 'products/:id/purchase', :controller => 'catalog',
:action => 'purchase'
  # This route can be invoked with purchase_url(:id => product.id)

  # Sample resource route (maps HTTP verbs to controller actions
automatically):
  # map.resources :products

  # Sample resource route with options:
  # map.resources :products, :member => { :short => :get, :toggle =>
:post }, :collection => { :sold => :get }

  # Sample resource route with sub-resources:
  # map.resources :products, :has_many => [ :comments, :sales ],
:has_one => :seller

  # Sample resource route within a namespace:
  # map.namespace :admin do |admin|
  # # Directs /admin/products/* to Admin::ProductsController
(app/controllers/admin/products_controller.rb)
  # admin.resources :products
  # end

  # You can have the root of your site routed with map.root -- just
remember to delete public/index.html.
   map.root :controller => "welcome"

  # See how all your routes lay out with "rake routes"

  # Install the default routes as the lowest priority.
  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'
end

Interesting.

The default routes should be catching those links.

I tried quickly putting these into a test application of mine and they
worked just fine. The "no route matches..." error only appeared when
my controllers were wrong, either missing or misspelled. For example,
if I created "app/controllers/terms_controller.rb" which has in it
exactly what you put in, then http://localhost:3000/terms works just
fine (well, in my example, I get Template Missing errors, but that's
simply because I didn't create the view code).

So, your logic isn't off... I suspect a typo or spelling error.

-Danimal

Try adding one route
  # Install the default routes as the lowest priority.
  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'

  map.connect ':controller/:action'

end

Your default get routes are looking for an ID which you are not
providing.

Lemme know if it works

Ruby Freak wrote:

Try adding one route
  # Install the default routes as the lowest priority.
  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'

  map.connect ':controller/:action'

end

Your default get routes are looking for an ID which you are not
providing.

Lemme know if it works

thx buddy.............all u r efforts.........its works............. :slight_smile:

Ruby Freak wrote:

Try adding one route
  # Install the default routes as the lowest priority.
  map.connect ':controller/:action/:id'
  map.connect ':controller/:action/:id.:format'

  map.connect ':controller/:action'

end

Your default get routes are looking for an ID which you are not
providing.

Lemme know if it works

thx buddy.............all u r efforts.........its works............. :slight_smile: