Ruby on Rails Thursday, January 26, 2012

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



--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment