No route matches

i have made a top navigation…

<%= link_to "Home", :controller => 'welcome' %>    <%= link_to "FAQ", :controller => 'faq' %>    <%= link_to "Contact", :controller => 'contact' %>    <%= link_to "Terms", :controller => 'terms' %>    <%= link_to "Login", :controller => 'account', :action => 'login' %>

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

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

Have you tried turning it off and on again?


Ryan B.

Feel free to add me to MSN and/or GTalk as this email.

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

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 N. <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

Ruby F. 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:

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 F. 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: