简体   繁体   中英

Rails routing issue — inconsistent paths generated

How come the first route doesn't have '/app' at the beginning of it in 'rake routes', but the others do?

scope :path => "/app" do
  namespace :admin do
    resources :work_appointments, :shallow => true do
      get :edit_from_scratch
      get :autocomplete_client_first, :on => :collection
      get :cancel, :on => :collection
      get :new_form, :on => :collection
      get :client, :on => :collection
    end
  end
end

==

rake routes =>
admin_work_appointment_work_appointment_edit_from_scratch GET    /admin/work_appointments/:work_appointment_id/edit_from_scratch(.:format) {:action=>"edit_from_scratch", :controller=>"admin/work_appointments"}
autocomplete_client_first_admin_work_appointments GET    /app/admin/work_appointments/autocomplete_client_first(.:format)          {:action=>"autocomplete_client_first", :controller=>"admin/work_appointments"}
cancel_admin_work_appointments GET    /app/admin/work_appointments/cancel(.:format)                             {:action=>"cancel", :controller=>"admin/work_appointments"}
new_form_admin_work_appointments GET    /app/admin/work_appointments/new_form(.:format)                           {:action=>"new_form", :controller=>"admin/work_appointments"}
client_admin_work_appointments GET    /app/admin/work_appointments/client(.:format)                             {:action=>"client", :controller=>"admin/work_appointments"}
admin_work_appointments GET    /app/admin/work_appointments(.:format)                                    {:action=>"index", :controller=>"admin/work_appointments"}
POST   /app/admin/work_appointments(.:format)                                    {:action=>"create", :controller=>"admin/work_appointments"}
new_admin_work_appointment GET    /app/admin/work_appointments/new(.:format)                                {:action=>"new", :controller=>"admin/work_appointments"}

删除:shallow => true选项

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM