Activeadmin semantic input partial and f.inputs togather

in activeadmin form when I do:

  form(:html => { :multipart => true })  do |f|

it shows all the fields nicely, and when it comes to belongs_to field it shows them as a collection but I want to replace this collection with a template of my belongs_to field.
Now if I want to use custom belongs_to field I can’t use the power of f.inputs because it will cause repetition. So what can we do now?

Well, currently using this as a solution:
at my “helper/active_admin_helper”:

	def form_inputs_for(m){|c|}{|s| !(s.end_with?"_id" or s.end_with?"_at" or s=="id") }
		columns.each do  |a|
        	input a

and at form:

ActiveAdmin.register ModelClass do
  require "helper/active_admin_helper"
      form(:html => { :multipart => true })  do |f| 
        f.inputs do
          render "admin/product", f:f

Let me know if you have better solution, in fact I am still looking for one…

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s