Sha256: d8b7cb21758d8bd08e7f551a9a5628af1457555b84879195d82a4fb676a8f438

Contents?: true

Size: 596 Bytes

Versions: 3

Compression:

Stored size: 596 Bytes

Contents

ActiveAdmin.register Part do

  form do |f|
    f.inputs "Part" do
      f.input :name
    end

    f.inputs "Fields" do
      f.has_many :field_templates, sortable: :position, allow_destroy: true do |a|
        a.input :title
        a.input :field_type, as: :select, collection: Field.constants.select {|c| Field.const_get(c).is_a? Class }.map { |f| f.to_s.underscore}
        a.input :is_required
      end
    end

    f.actions
  end

  member_action :serialized, :method => :get do
    render resource
  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.rb
activeadmin-magicfields-0.4.1 lib/app/admin/part.rb
activeadmin-magicfields-0.4.0 lib/app/admin/part.rb