0

对不起,我不能更好地问这个问题。我希望能够创建一个站并将其保存到数据库中,而不必知道路线。如何更改我的模型?

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

我正在使用rubinius,data_mapper 1.2mariadb.

4

0 回答 0