3

我有2个模型。UserProject。并且它们之间存在 many_to_many 关系和额外position字段。我在 rails_admin 编辑页面上看不到那个额外的字段。

如何将该字段添加到表单中?

用户.rb

has_many :projects, :through => :works_ons

项目.rb

has_many :users, :through => :works_ons

works_on.rb

attr_accessible :position, :project_id, :user_id

belongs_to :user
belongs_to :project
4

2 回答 2

1

这是我找到的最接近的。您可能应该在关联下方添加一个自定义字段并输入额外的字段。

https://github.com/sferik/rails_admin/wiki/Has-many-%3Athrough-association

于 2013-08-12T01:42:12.540 回答
1

你的用户模型是真的吗has_many :users, :through => :works_ons?

我想知道你是否需要

用户.rb

has_many :projects, :through => :works_ons
于 2013-07-25T01:49:47.353 回答