输入字段未在ActiveAdmin嵌套模型中显示

时间:2016-01-10 04:52:46

标签: ruby-on-rails ruby-on-rails-4 activeadmin

enter image description here您好我有两个名为Search_result和sharing_type的模型。我在两个模型之间使用了has_many关联。 在我的search_result.rb

class SearchResult < ActiveRecord::Base
  has_many :sharing_types ,dependent: :destroy
  accepts_nested_attributes_for :sharing_types, allow_destroy: true
end

在我的sharing_type.rb中我定义为

class SharingType < ActiveRecord::Base
    belongs_to :search_result
 end

在我的ActiveAdmin中

ActiveAdmin.register SearchResult do

 permit_params:gender,:postdate:location_cd,:location_name,
sharing_types_attributes: [:id, :typename ]
form multipart: true  do |f|
    f.input :gender
    f.input :postdate, :required => false
    f.input :location_cd, :required => false, :label => "Location Code"
    f.input :location_name, :required => false, :label => "Location Name"
    f.inputs "sharing_types" do
      f.has_many :sharing_types, allow_destroy: true do |cf|
        cf.input :typename 
      end
    end
     f.actions
 end
end

在我的活动管理视图中,没有显示typename的输入字段。

0 个答案:

没有答案