0

我目前正試圖讓我的Ruby on Rails應用程序在生產環境中運行。它工作正常,但是當我一個嵌套的命名空間下添加路由它給我錯誤說在當地工作正常但不在生產中的路線

的ActionController :: RoutingError(未初始化的常數代理::客戶::的AccountController)

此路線我的本地機器上都工作正常,這條路線是這樣的

namespace :agent do 
root      :to => redirect('url') 
match 'dashboard',  :to => 'dashboard#index' 
match 'account',   :to => 'account#edit' 
match 'account/update', :to => 'account#update' 

namespace :clients do 
    root    :to => redirect('url') 

**# This part I added and is giving routing error** 
    match 'accounts/invite', :to => 'clients/account#invite' 
    match 'accounts/sendinvite', :to => 'clients/account#send_invitation' 

我耙途徑給予妥善的路線。 任何建議如何解決這個問題?

+2

你有一個叫代理::客戶::中的AccountController控制器:應用程序/控制器/代理/客戶/ account_controller.rb – rainkinz 2013-02-27 07:33:16

+0

可能是一個多元化的問題:'clients/accounts#invite' vs'clients/account#invite'等等,檢查你的控制器是否被命名爲你認爲應該命名的名稱 – Brian 2013-02-27 07:45:36

+0

你在命名空間的末尾是否有'end'塊? – Edward 2013-02-27 07:47:31

回答

0

讓你無論想做

match 'accounts/invite', :to => 'clients/accounts#invite' 
match 'accounts/sendinvite', :to => 'clients/accounts#send_invitation' 

或者

match 'accounts/invite', :to => 'agent/account#invite' 
match 'accounts/sendinvite', :to => 'agent/account#send_invitation' 
+1

我現在做了一個猴子路徑來解決這個問題,我在名稱空間之外創建了兩條單獨的路徑,並硬編碼了控制器/操作的路徑,並且令人驚訝地發現它工作正常。 – 2013-02-27 09:42:35

相關問題