Panayotis Matsinopoulos
2012-May-30 08:30 UTC
Why does it route to "show" when excepting "new"?
HI, I have the following in my routes: resources :photos, :except => [:new, :edit] When I get "/photos/new" instead of getting a no route error, it routes to "show" and recognizes "new" as id. Is that normal? Panayotis -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
This is not a core ruby on rails question. This would be more suited for the Rubyonrails-talk mailing list. I will still answer it though. The reason for this is due to how it matches the route for the show action. The route is like this: /posts/:id.:format This means anything following /posts that doesn''t have a similar route defined for it will go to show, such as your /posts/new. Just because you except the route doesn''t mean it will stop ALL routes from working that use that route. It means that it simply DOESN''T define the route for it. Anything else can have a route defined for that and it will still work. Please be more careful about what lists you post to in the future. -- Ryan Bigg On Wednesday, 30 May 2012 at 18:30, Panayotis Matsinopoulos wrote:> HI, > > I have the following in my routes: > > resources :photos, :except => [:new, :edit] > > When I get "/photos/new" instead of getting a no route error, it > routes to "show" and recognizes "new" as id. > > Is that normal? > > Panayotis > > -- > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > To post to this group, send email to rubyonrails-core@googlegroups.com. > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. > For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.
Panayotis Matsinopoulos
2012-May-30 08:55 UTC
Re: Why does it route to "show" when excepting "new"?
Thanks for answer. Will be more careful on posting too. Panayotis On May 30, 11:46 am, Ryan Bigg <radarliste...@gmail.com> wrote:> This is not a core ruby on rails question. This would be more suited for the Rubyonrails-talk mailing list. > > I will still answer it though. > > The reason for this is due to how it matches the route for the show action. The route is like this: > > /posts/:id.:format > > This means anything following /posts that doesn''t have a similar route defined for it will go to show, such as your /posts/new. > > Just because you except the route doesn''t mean it will stop ALL routes from working that use that route. It means that it simply DOESN''T define the route for it. Anything else can have a route defined for that and it will still work. > > Please be more careful about what lists you post to in the future. > > -- > Ryan Bigg > > > > > > > > On Wednesday, 30 May 2012 at 18:30, Panayotis Matsinopoulos wrote: > > HI, > > > I have the following in my routes: > > > resources :photos, :except => [:new, :edit] > > > When I get "/photos/new" instead of getting a no route error, it > > routes to "show" and recognizes "new" as id. > > > Is that normal? > > > Panayotis > > > -- > > You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. > > To post to this group, send email to rubyonrails-core@googlegroups.com. > > To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. > > For more options, visit this group athttp://groups.google.com/group/rubyonrails-core?hl=en.-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To post to this group, send email to rubyonrails-core@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-core?hl=en.