首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >LocomotiveCMS has_many/belongs_to不工作

LocomotiveCMS has_many/belongs_to不工作
EN

Stack Overflow用户
提问于 2014-01-22 10:02:37
回答 1查看 244关注 0票数 2

由于某些原因,我不能让has_many/ cannot _ to关系工作。嵌套的内容类型不会显示在父级中。这就是我所拥有的:

app/content_type/news_Phoos.yml

代码语言:javascript
复制
- article:
    label: News articles
    type: belongs_to
    target: news_articles

app/content_types/news_articles.yml

代码语言:javascript
复制
- 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

谢谢你的帮助!

EN

回答 1

Stack Overflow用户

发布于 2015-12-27 07:09:39

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

inverse_of的值应该是在其他模型中具有belongs_to关系的属性的名称,在本例中为news_photos

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/21272788

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档