I''m not sure if I''m doing something wrong or there is a problem with namespaces and routes in 3.0.0.beta version. After creating new application I''ve generated new controller with script/rails generate controller Admin::Dashboard show and added: namespace :admin do resource :dashboard end to routes.rb, but http://localhost:3000/admin/dashboard resulted in routing error: No route matches "/admin/dashboard". Maybe I''m wrong but it looks like problem is in mapper.rb line 391: def controller options[:controller] || plural end where pluralized version of controller is returned so even: rake routes returns correct list of routes (in singular form) final target has pluralized version (admin/dashboards) and routing error occurs. Now I''m wondering whether I''ve wrongly defined route or controller method should be: def controller options[:controller] || singular end -- 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.
resource :session do get :jumpin, :as => ''session'' post :forgot_password, :as => ''session'' end I think I have seen this issue. In my code I have had to use the :as option to get the generated helper methods to work. Without the :as option I can still hit the actions, but it is just the _url|path helpers that are not working. I''m swamped and have not made a ticket yet. - Ken On Feb 8, 2010, at 1:01 PM, Bosko Ivanisevic wrote:> I''m not sure if I''m doing something wrong or there is a problem with > namespaces and routes in 3.0.0.beta version. After creating new > application I''ve generated new controller with > > script/rails generate controller Admin::Dashboard show > > and added: > > namespace :admin do > resource :dashboard > end > > to routes.rb, but http://localhost:3000/admin/dashboard resulted in > routing error: No route matches "/admin/dashboard". Maybe I''m wrong > but it looks like problem is in > mapper.rb line 391: > > def controller > options[:controller] || plural > end > > where pluralized version of controller is returned so even: > > rake routes > > returns correct list of routes (in singular form) final target has > pluralized version (admin/dashboards) and routing error occurs. Now > I''m wondering whether I''ve wrongly defined route or controller method > should be: > > def controller > options[:controller] || singular > end > > -- > 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.
Rails expects the controller name to be pluralized even when using singular resources. The rails3 beta is wrongly reporting Routing Errors when anything goes wrong with the controller. See https://rails.lighthouseapp.com/projects/8994/tickets/3862-cryptic-routing-error-when-applicationcontroller-has-a-bug. On Feb 9, 5:01 am, Bosko Ivanisevic <bosko.ivanise...@gmail.com> wrote:> I''m not sure if I''m doing something wrong or there is a problem with > namespaces and routes in 3.0.0.beta version. After creating new > application I''ve generated new controller with > > script/rails generate controller Admin::Dashboard show > > and added: > > namespace :admin do > resource :dashboard > end > > to routes.rb, buthttp://localhost:3000/admin/dashboardresulted in > routing error: No route matches "/admin/dashboard". Maybe I''m wrong > but it looks like problem is in > mapper.rb line 391: > > def controller > options[:controller] || plural > end > > where pluralized version of controller is returned so even: > > rake routes > > returns correct list of routes (in singular form) final target has > pluralized version (admin/dashboards) and routing error occurs. Now > I''m wondering whether I''ve wrongly defined route or controller method > should be: > > def controller > options[:controller] || singular > end-- 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.
On Feb 9, 1:18 pm, Lachlan <lachlan.sylves...@hypothetical.com.au> wrote:> Rails expects the controller name to be pluralized even when using > singular resources. The rails3 beta is wrongly reporting Routing > Errors when anything goes wrong with the controller. Seehttps://rails.lighthouseapp.com/projects/8994/tickets/3862-cryptic-ro.... >If you are right that Rails expect the controller name to be pluralized then ''rake routes'' give wrong result. Because with route: namespace :admin do resource :dashboard end routes are: GET /admin/dashboard(.:format) {:controller=>"admin/dashboards", :action=>"show"} POST /admin/dashboard(.:format) {:controller=>"admin/dashboards", :action=>"create"} PUT /admin/dashboard(.:format) {:controller=>"admin/dashboards", :action=>"update"} admin_dashboard DELETE /admin/dashboard(.:format) {:controller=>"admin/dashboards", :action=>"destroy"} new_admin_dashboard GET /admin/dashboard/new(.:format) {:controller=>"admin/dashboards", :action=>"new"} edit_admin_dashboard GET /admin/dashboard/edit(.:format) {:controller=>"admin/dashboards", :action=>"edit"} so path is in singular form and controller is expected to be in plural. On the other hand with: namespace :admin do resources :dashboard end both paths and controller are in plural: GET /admin/dashboards(.:format) {:controller=>"admin/dashboards", :action=>"index"} admin_dashboards POST /admin/dashboards(.:format) {:controller=>"admin/dashboards", :action=>"create"} new_admin_dashboard GET /admin/dashboards/new(.:format) {:controller=>"admin/dashboards", :action=>"new"} GET /admin/dashboards/:id(.:format) {:controller=>"admin/dashboards", :action=>"show"} PUT /admin/dashboards/:id(.:format) {:controller=>"admin/dashboards", :action=>"update"} admin_dashboard DELETE /admin/dashboards/:id(.:format) {:controller=>"admin/dashboards", :action=>"destroy"} edit_admin_dashboard GET /admin/dashboards/:id/edit(.:format) {:controller=>"admin/dashboards", :action=>"edit"} I guess I''m missing something but I still cannot figure out what :-( -- 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.