简体   繁体   English

show_admin表中的has_many表?

[英]rails_admin table of has_many in the show?

I would like to show a related has_many set of objects in the show view of the parent object as a table. 我想在父对象的show视图中显示一个相关的has_many对象集作为表。

Currently the has_many items are just being shown as a list separated by commas. 目前,has_many项目仅显示为以逗号分隔的列表。

How can I show the has_many items as a table and specify the columns to include? 如何将has_many项显示为表并指定要包含的列?

For example Article has_many Autors . 例如文章 has_many Autors

Then you should just add in Article class: 然后你应该添加Article类:

accepts_nested_attributes_for :autors, allow_destroy: true
attr_accessible :autors_attributes

More info https://github.com/sferik/rails_admin/wiki/Has-and-belongs-to-many-association 更多信息https://github.com/sferik/rails_admin/wiki/Has-and-belongs-to-many-association

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM