How to add multiple user create on single form using ActiveAdmin

HI All,

I am currently creating an Admin utility for courier management service, where I need to include a form to submit two users(same model) on same form, I don’t know to implement exactly but duplicated the user form twice which is displaying the form twice on the browser but unable to save the both the users, listed below my Admin customer register file and attached the screen shot for your reference .

Also want to know, how to add additional business logics to admin, for example adding print functionality for the single user on ‘view’ page.

ActiveAdmin.register Customer do

form do |f|
#User one
f.inputs “Sender Details” do

  f.input :name
   f.input :email

   f.input :street
   f.input :city

   f.input :state
   f.input :pin

   f.input :customer_type,:as => :select, :collection => [["Package Sender", "Package Sender"], ["Package Receiver","Package Receiver"]]

end

#User two

f.inputs “Receiver Details” do

  f.input :name
   f.input :email

   f.input :street
   f.input :city

   f.input :state
   f.input :pin

   f.input :customer_type,:as => :select, :collection => [["Package Sender", "Package Sender"], ["Package Receiver","Package Receiver"]]

end

f.inputs do     

  f.has_many :packages do |p|
   p.input :weight
   p.input :amount

   p.input :received_date
   p.input :amount

   end
end
f.buttons

end
end

regards,
Loganathan

controller

Disclaimer: I haven't tried ActiveAdmin, so this is just about Rails in general.

I did something sorta like this in The Decider. The Edit Decision
view includes editable display of each Decision's Factors,
Alternatives, and Rankings. (Which should have been called Ratings
but that's another story.) These are each separate models. You can
use the app yourself at http://thedecider.herokuapp.com and see the
code at https://github.com/davearonson/thedecider/.

To do like I did, just have your Customer model say it accepts nested
attributes for users, and in your order view, use fields_for when
displaying the Users. IIRC, that was all I had to do! (Nitpick: I
don't understand why a Customer would be/have two Users. Are you sure
your model shouldn't be Shipment or Order or ServiceCall or something
like that?)

I couldn't find any good clear online documentation of how this works
and what you need to do. By experimenting, I found that Rails will
take care of the rest with its wonderful behind-the-scenes magic of
tagging things with appropriate name and id attributes in the HTML,
and interpreting those when returned, so you pretty much don't need to
do *anything*! You *can* define an attributes= method if you want,
but chances are very good that what Rails will do by default is
exactly what you want, and any attempt to provide that yourself will
just mean having write a lot of tedious code.

-Dave