如何在data_mapper中创建可选的多对多关联?

时间:2013-09-12 06:22:20

标签: ruby ruby-datamapper rubinius datamapper-1.2

对不起,我不能更好地提出这个问题。我希望能够创建一个站并将其保存到数据库中,而无需了解该路由。我如何更改模型?

class Station
  include DataMapper::Resource

  property :id,         String, :key => true

  has n, :routes, :through => Resource
end

class Route
  include DataMapper::Resource

  property :id,   Serial, :key => true

  has n, :stations, :through => Resource
end

我正在使用rubiniusdata_mapper 1.2mariadb

0 个答案:

没有答案