2

出于某种原因,我无法让 has_many/belongs_to 关系起作用。嵌套内容类型不会显示在父级中。这是我所拥有的:

应用程序/content_types/news_photos.yml

- article:
    label: News articles
    type: belongs_to
    target: news_articles

应用程序/content_types/news_articles.yml

- news_photos:
    label: News photos
    type: has_many
    target: news_photos
    class_name: news_photos
    inverse_of: news_article
    required: false
    hint: A description of the field for the editors
    localized: false
    ui_enabled: true

谢谢您的帮助!

4

1 回答 1

0

我不确定您是否找到了解决方案,但问题实际上在于命名。has_many定义应该有inverse_of: article

的值inverse_of应该是belongs_to在其他模型中具有关系的属性的名称,在这种情况下是news_photos

于 2015-12-26T23:09:39.247 回答