How can I customize Administrate dashboard to edit nested object attributes in ruby on rails?

20 Views Asked by At

I have an AB test dashboard in which I can edit (add/remove) existing AB variants, but I also want to be able to edit each variant's attributes on the same AbTest#edit page.

ab_test_dashboards.rb:

  ATTRIBUTE_TYPES = {
    id: Field::Number,
    name: Field::String,
    key: Field::String,
    ab_variants:
      HasManyScopedField.with_options(collection_attributes: %i[value weight]),
    created_at: RelativeTimeField.with_options(format: "%b %d, %Y"),
    updated_at: RelativeTimeField.with_options(format: "%b %d, %Y"),
  }.freeze

...

  FORM_ATTRIBUTES = [
    :name,
    :key,
    :ab_variants
  ].freeze

I'm stuck on how I can modify these attributes. I've looked into nested forms and nested attributes but I have no clue on how to integrate this with administrate. Any pointers in the right direction would be greatly appreciated!

0

There are 0 best solutions below