Heim  >  Fragen und Antworten  >  Hauptteil

ruby - DataMapper怎么指定表名?

初学DataMapper,建了以下类:

rubyclass Node
  include DataMapper::Resource

  property :nid,         Serial
  property :title,       String
end

但报错:
~ Table 'NWST.nodes' doesn't exist (code: 1146, sql state: 42S02, query: SELECT nid, title FROM nodes ORDER BY nid, uri: mysql:root@127.0.0.1/NWST?scheme=mysql&user=root&password=&host=127.0.0.1&port=&path=/NWST&query=&fragment=&adapter=mysql)

这是因为表名是node,DM自动改为复数名,如何才能指定表名?

天蓬老师天蓬老师2707 Tage vor700

Antworte allen(1)Ich werde antworten

  • 巴扎黑

    巴扎黑2017-04-24 09:12:15

    DM自动改为复数名,如何才能指定表名?

    Antwort
    0
  • StornierenAntwort