Move, rename and remove fields

When building your admin panel, you will probably want to hide as much complexity from your users as you can.

This includes:

  • Hiding technical and confidential fields

  • Using naming conventions that the final user understands.

Moving fields

You can import fields from single record relationships into your collections.

The imported fields will behave as if they were on that collection.

Traditional Syntax

Using full context methods with customize_collection:

# Assuming the following structure:
# User    { id, firstName, lastName, addressId }
# Address { id, streetName, streetNumber, city, countryId }
# Country { id, name }
@create_agent.customize_collection('user') do |collection|
  collection.import_field('city', { path: 'address:city', readonly: true })
            .import_field('country', { path: 'address:country:name', readonly: true })
end

DSL Syntax

Using simplified DSL with collection:

Note that when using readonly: false, the referenced record fields can be edited.

Renaming and removing fields and relations

Renaming and removing fields or relations can be done simply by calling the rename_field and remove_field methods.

Traditional Syntax

Using full context methods with customize_collection:

DSL Syntax

Using simplified DSL with collection:

Last updated

Was this helpful?