Sha256: a95229bc72888509fab1ae0375a68eba892ff8220751b24279adbd46912a7bda

Contents?: true

Size: 819 Bytes

Versions: 3

Compression:

Stored size: 819 Bytes

Contents

ActiveAdmin.register PartObject do

  menu false

  FIELDABLES = Field.constants.select {|c| Field.const_get(c).is_a? Class }.map {|f| Field.const_get(f) }

  form builder: ActiveadminMagicfields::FormBuilder, :html => { :'data-type' => :json, :enctype => "multipart/form-data", :remote => true } do |f|
    f.inputs do
      f.input :base_model_id, as: :hidden
      f.magicfields_has_many :part_object_fields, :fieldable, types: FIELDABLES, sortable: :position, allow_destroy: true
    end
    f.actions
  end

  # permit_params do
  #   permitted = PartObject.new.attributes.keys | [:id, part_object_fields_attributes: [:id, :fieldable_type, :fieldable_id, :position, :_destroy, fieldable_attributes: [:id] ] ]
  #   permitted
  # end

  controller do
    def permitted_params
      params.permit!
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activeadmin-magicfields-0.4.2 lib/app/admin/part_object.rb
activeadmin-magicfields-0.4.1 lib/app/admin/part_object.rb
activeadmin-magicfields-0.4.0 lib/app/admin/part_object.rb