【发布时间】:2014-05-23 16:44:45
【问题描述】:
我有一个具有_many Task_Orders 的合同模型。我正在尝试呈现一个视图,如果我单击合同行项目的“显示”,它将显示属于该合同的 Task_Orders 列表。
这是我的合同架构:
create_table "contracts", force: true do |t|
t.string "contractId"
t.string "contractName"
这是我的任务顺序架构:
create_table "task_orders", force: true do |t|
t.integer "contract_Id", limit: 255
t.string "task_orderId"
t.string "task_orderName"
这是我的合同模型:
class Contract < ActiveRecord::Base
has_many :task_orders
end
这是我的任务顺序模型:
class TaskOrder < ActiveRecord::Base
belongs_to :contract
end
我不完全确定如何使用控制器和视图来实现它......请帮助。我正在使用 Rails 4.0
谢谢。
【问题讨论】:
标签: ruby-on-rails view render