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
精彩评论