代码之家  ›  专栏  ›  技术社区  ›  Josiah Kiehl

DataMapper关联:如何指定包含关联行的表名?

  •  0
  • Josiah Kiehl  · 技术社区  · 15 年前

    我正在使用一个已经存在并被其他应用程序使用的数据库。

    例如:

    class Foo
      has n :components # => the table name here should be COMPONENT, but datamapper uses COMPONENTS
    end 
    

    1 回复  |  直到 15 年前
        1
  •  9
  •   Matchu    15 年前

    更改模型本身的名称。

    class Component
      # ...
      storage_names[:default] = 'component'
    end
    
    推荐文章