Activeadmin for nested models
<p>Hi I am trying to build an application where i am using Activeadmin for Search_result model .search_result model used to save paying guest information .every PG has sharing type (like Individual ,single,double) and price for each sharing type.i have created total three model named search_result ,sharing_type,pricelist .
i want to create an activeadmin form to save PG information along with sharing_type and pricelist .
in seach_result.rb </p>

<pre><code>class SearchResult &lt; ActiveRecord::Base
    has_attached_file :pg_images,:styles =&gt; {
      :thumb =&gt; "100x100#",
      :small  =&gt; "150x150&gt;",
      :medium =&gt; "400x200" }, default_url: "/images/missing.png"
  validates_attachment :pg_images,
  content_type: { content_type: ["image/jpeg", "image/gif", "image/png"] }
  has_many :sharing_types ,dependent: :destroy
  accepts_nested_attributes_for :sharing_types, allow_destroy: true
end
</code></pre>

<p>in sharing_type.rb model </p>

<pre><code>class SharingType &lt; ActiveRecord::Base
    belongs_to :search_result
    has_many :pricelists ,dependent: :destroy 
    accepts_nested_attributes_for :pricelists, allow_destroy: true
end
</code></pre>

<p>and in pricelist.rb</p>

<pre><code>class Pricelist &lt; ActiveRecord::Base
    belongs_to :sharing_type
end
</code></pre>

<p>now i tring to create a form in activeadmin </p>

<pre><code>ActiveAdmin.register SearchResult do


 permit_params :gender,:pgname,:pgadress,:pgrent,:secdeposit,:postdate,:image,:pg_images ,:sharing_type,:food_type,:meals_type,:location_cd ,:location_name
form multipart: true  do |f|
  f.inputs 'PG Details ' do


    f.input :gender, :required =&gt; false , :label =&gt; "Gender"
    f.input :pgname, :required =&gt; false, :label =&gt; "PG Name"
    f.input :pgadress, :required =&gt; false, :label =&gt; "PG Address"
    f.input :pgrent, :required =&gt; false, :label =&gt; "PG Rent"
    f.input :secdeposit, :required =&gt; false, :label =&gt; "PG Deposit"
    f.input :postdate, :required =&gt; false, :label =&gt; "PG Post Date"
    f.input :location_cd, :required =&gt; false, :label =&gt; "Location Code"
    f.input :location_name, :required =&gt; false, :label =&gt; "Location Name"
    f.input :food_type, :required =&gt; false, :label =&gt; "Food Type"
    f.input :meals_type, :required =&gt; false, :label =&gt; "Meals Type"
    f.input :pg_images, :required =&gt; false, :as =&gt; :file
end

  f.inputs 'Sharing_types' do |d|
      d.input :typename,:as =&gt; :select , :collection =&gt; SharingType.all
    end
  f.actions
 end
 end
</code></pre>

<p>i am stucked at this point can anyone please help me to complete this task.</p>