2012-07-25 69 views
2

我已經移動到我的rails應用程序的CRUD操作的命名空間。在我的路線文件我已經做了:具有新命名空間的未定義局部變量或方法`new_admin_company'

namespace :admin do 
     root :to => 'companies#index' 
     resources :events 

     resources :vacancies 

     resources :contacts 

     resources :companies do 
     get :getCompanies, :on => :collection 
     end 
end 

我得到這個,當我運行rake routes

admin_root  /admin(.:format)      admin/companies#index 
       admin_events GET /admin/events(.:format)     admin/events#index 
          POST /admin/events(.:format)     admin/events#create 
      new_admin_event GET /admin/events/new(.:format)    admin/events#new 
      edit_admin_event GET /admin/events/:id/edit(.:format)  admin/events#edit 
       admin_event GET /admin/events/:id(.:format)    admin/events#show 
          PUT /admin/events/:id(.:format)    admin/events#update 
          DELETE /admin/events/:id(.:format)    admin/events#destroy 
      admin_vacancies GET /admin/vacancies(.:format)    admin/vacancies#index 
          POST /admin/vacancies(.:format)    admin/vacancies#create 
      new_admin_vacancy GET /admin/vacancies/new(.:format)   admin/vacancies#new 
      edit_admin_vacancy GET /admin/vacancies/:id/edit(.:format)  admin/vacancies#edit 
       admin_vacancy GET /admin/vacancies/:id(.:format)   admin/vacancies#show 
          PUT /admin/vacancies/:id(.:format)   admin/vacancies#update 
          DELETE /admin/vacancies/:id(.:format)   admin/vacancies#destroy 
       admin_contacts GET /admin/contacts(.:format)    admin/contacts#index 
          POST /admin/contacts(.:format)    admin/contacts#create 
      new_admin_contact GET /admin/contacts/new(.:format)   admin/contacts#new 
      edit_admin_contact GET /admin/contacts/:id/edit(.:format)  admin/contacts#edit 
       admin_contact GET /admin/contacts/:id(.:format)   admin/contacts#show 
          PUT /admin/contacts/:id(.:format)   admin/contacts#update 
          DELETE /admin/contacts/:id(.:format)   admin/contacts#destroy 
getCompanies_admin_companies GET /admin/companies/getCompanies(.:format) admin/companies#getCompanies 
      admin_companies GET /admin/companies(.:format)    admin/companies#index 
          POST /admin/companies(.:format)    admin/companies#create 
      new_admin_company GET /admin/companies/new(.:format)   admin/companies#new 
      edit_admin_company GET /admin/companies/:id/edit(.:format)  admin/companies#edit 
       admin_company GET /admin/companies/:id(.:format)   admin/companies#show 
          PUT /admin/companies/:id(.:format)   admin/companies#update 
          DELETE /admin/companies/:id(.:format)   admin/companies#destroy 

然而,我發現了錯誤:

undefined local variable or method `new_admin_company' 

所以我有什麼把東西移動到命名空間時忘了做什麼?

回答

3

它應該是new_admin_company_path。

0

檢查您的公司控制器中是否有「新」方法。

相關問題