我們正在測試spec/dummy下的customerx引擎。引擎customerx的索引頁面可以無任何錯誤地顯示。這裏是鏈接:控制器無法看到def new/create for rails 3.2.8引擎
<li><%= link_to 'Customers', customerx.customer_status_categories_path %></li>
但是有路由錯誤uninitialized constant CustomerStatusCategoriesController
新的客戶鏈接如下:
<li><%= link_to 'New Customer', customerx.new_customer_status_category_path %></li>
的rake routes
確實顯示正確的新顧客路線:
Routes for Customerx::Engine:
customer_status_categories_index GET /customer_status_categories/index(.:format) customer_status_categories#index
customer_status_categories_new GET /customer_status_categories/new(.:format) customer_status_categories#new
customer_status_categories_create GET /customer_status_categories/create(.:format) customer_status_categories#create
customer_status_categories_edit GET /customer_status_categories/edit(.:format) customer_status_categories#edit
customer_status_categories_update GET /customer_status_categories/update(.:format) customer_status_categories#update
customer_status_categories GET /customer_status_categories(.:format) customerx/customer_status_categories#index
POST /customer_status_categories(.:format) customerx/customer_status_categories#create
new_customer_status_category GET /customer_status_categories/new(.:format) customerx/customer_status_categories#new
edit_customer_status_category GET /customer_status_categories/:id/edit(.:format) customerx/customer_status_categories#edit
customer_status_category PUT /customer_status_categories/:id(.:format) customerx/customer_status_categories#update
在routes.rb爲引擎customerx,資源聲明爲:
resources :customer_status_categories, :only => [:index, :new, :create, :edit, :update]
編輯/索引沒有路由錯誤。新建/創建所有通行證的rspec情況。這個問題似乎沒有找到新的動作(在刪除新的和創建的def後,錯誤是相同的)。
導致錯誤的代碼有什麼錯誤?感謝幫助。