2011-07-20 72 views
1

讓我們回到黃銅大頭釘。inherited_resources和多個belongs_to沒有嵌套

滑軌:2.3.11

我使用inherited_resources引用兩個單獨的和非嵌套資源具有控制器。

我的控制器是如下所示:

class Tools::DeploymentLinesController < ToolsController 
    inherit_resources 
    belongs_to :deployment 
    belongs_to :ticket 
end#Tools::DeploymentLinesController 

然而,inherit_resources被假定belongs_to :ticketdeployment嵌套資源。

是否有任何方法在我的控制器中使用兩個belongs_to而沒有嵌套?或者我需要寫出自己的業務邏輯來解釋遺漏的inherited_resources關聯?

回答

2

您應該能夠使用:

belongs_to :deployment, :ticket