【发布时间】:2011-01-17 21:45:53
【问题描述】:
class Task
include DataMapper::Resource
has 1, :list, :through => Resource
end
class List
include DataMapper::Resource
has n, :tasks, :through => Resource
end
一个列表有很多任务。假设我有一个 id = 1 的任务。
如何找到有此任务的列表?
我试过:List.first(:tasks => task) 但它总是返回 nil。
谢谢。
【问题讨论】:
标签: ruby sinatra datamapper one-to-many