class ActiveAdmin::FormBuilder
This form helper allows us to create form for nested belongs_to association.
Public Instance Methods
has_one_nested(association, options = {}, &block)
click to toggle source
# File lib/activeadmin_draggable/sortable_tree.rb, line 56 def has_one_nested(association, options = {}, &block) options = { :for => association }.merge(options) options[:class] ||= "" options[:class] << "inputs has_one_field" #looks dirty...but works (still better than active admin's way) if object.new_record? content = inputs_for_nested_attributes :for => [association, object.class.reflect_on_association(association).klass.new], &block form_buffers.last << content.html_safe else content = inputs options, &block end end