John Mcleod wrote: > Hello all, > Here's a newbie question (4 weeks and counting). > My routes.rb is as below. > > map.resources :projects, :departments, :users, :admins, :imports, :notes > > #Below is route in question > map.resources :projects, :collection => { :view_all => :get } > > map.home '', :controller => 'projects', :action => 'index' > map.connect ':controller/:action/:id.:format' > map.connect ':controller/:action/:id' > > I'm tried to get a url like this: > http://localhost:3000/projects/view_all > > I have a view_all in the ProjectsController and I have a view_all > template. > > When I type in the desired url, I get this error: > > "ActiveRecord::RecordNotFound in ProjectsController#show > > Couldn't find Project with ID=view_all" > > Thank you for any help. > > JohnM
Your view_all == default index That being said, when you add a controller method like view_all, you'll need to tell the routes about it (add view_all as a get method for the collection) map.resources :projects, :collection => {:view_all => :get} -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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 rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---