Ruby on rails 如何在activeadmin上显示嵌套记录?

Ruby on rails 如何在activeadmin上显示嵌套记录?,ruby-on-rails,activeadmin,Ruby On Rails,Activeadmin,到目前为止,我有两个模型,用户和配置文件 Class User < ActiveRecord::Base has_one :profile accepts_nested_attributes_for :profile Class Profile < ActiveRecord::Base belongs_to :user 所以我想在用户表单上获取配置文件数据。我尝试了几件事,但都没能得到 类似于 f.inputs 'Profile', :for => [:prof

到目前为止,我有两个模型,用户和配置文件

Class User < ActiveRecord::Base
  has_one :profile
  accepts_nested_attributes_for :profile

Class Profile < ActiveRecord::Base
  belongs_to :user
所以我想在用户表单上获取配置文件数据。我尝试了几件事,但都没能得到

类似于

f.inputs 'Profile', :for => [:profile, f.object.profile || Profile.new] do |profile_form|
  profile_form.input ...
  ...
end
在f.inputs中,“用户”块应该可以工作。只需使用Profile_form在该块内设置Profile的属性

f.inputs 'Profile', :for => [:profile, f.object.profile || Profile.new] do |profile_form|
  profile_form.input ...
  ...
end