0
路由請看下面的例子:導軌和路徑選項
devise_for :users, path: ':school_id/', controllers: {
sessions: 'users/sessions',
confirmations: 'users/confirmations',
registrations: 'users/registrations',
passwords: 'users/passwords',
}
devise_scope :user do
get "sign_out" => 'users/sessions#destroy', as: :sign_out
post "add_lectures" => 'users#add_lectures', as: :user_add_lectures
end
當我做一個Ajax請求/add_lectures
Rails的認爲我試圖訪問/:school_id/users/..
因爲path
選項供用戶路線。換句話說,Rails認爲add_lectures
是參數school_id
的一種形式。
如何解決此問題?