2011-11-02 73 views
3

我正在用datamapper进行博客服务,并定义了如下所示的Article和Tag模型。datamapper多对多表名

class Article 
    include DataMapper::Resource 

    property :id, Serial 

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

class Tag 
    include DataMapper::Resource 

    property :id, Serial 

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

而这些关系在'article_tags'表中定义。

  • 该表名称是如何定义的?
  • 为什么不'articles_tags'?
  • 我可以在不创建自定义表模型类的情况下更改表名吗?

对不起我的英文不好。

回答