Rails路由问题 - 生成不一致的路径

时间:2012-02-13 22:43:32

标签: ruby-on-rails ruby-on-rails-3 routes

为什么第一条路线在'rake routes'的开头没有'/ app',但其他路线呢?

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

1 个答案:

答案 0 :(得分:0)

删除:shallow => true选项