开发者

inherited_resources and multiple belongs_to without nesting

Let's get down to brass tacks.

Rails: 2.3.11

I have a controller using inherited_resources t开发者_Go百科o reference two separate and non-nested resources.

My controller is as shown:

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

However, inherit_resources is assuming that the belongs_to :ticket is a nested resource of deployment.

Is there any way of using two belongs_to in my controller without nesting? Or do I need to write out my own business logic to account for a missing inherited_resources association?


You should be able to use:

belongs_to :deployment, :ticket
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜