On Aug 28, 2009, at 11:34 AM, 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 }

Routes have preference based on their order of appearance. The first  
time you create routes for :projects, there's a show route like / 
projects/:id and that matches before the second one.

Combine those into:

map.resources :projects, :collection => { :view_all => :get }
map.resources :departments, :users, :admins, :imports, :notes

HOWEVER, the regular route:
        /projects
is normally going to show you all the projects anyway.

-Rob

Rob Biedenharn          http://agileconsultingllc.com
r...@agileconsultingllc.com


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



--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to