我有以下型号:

Category

has_and_belongs_to_many :subcategories
has_many :resources

Subcategory

has_and_belongs_to_many :categories
has_and_belongs_to_many :resources
Resource

has_and_belongs_to_many :subcategories
belongs_to  :category
.

在rails_admin创建或编辑资源时,我想为所选类别显示子类别。

如何在rails_admin中这样做?

有帮助吗?

解决方案

这个 post 应该给你几个选项给你你需要的东西。而且,这里是另一个 post 关于rails_admin的关系构建自定义视图。

编辑

签出这篇文章 rails3 + typus:显示habtm关系作为复选框

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top