Skip to content

Default settings #2699

Open
Open
@adrianthedev

Description

@adrianthedev

Context

We want to give the ability to developers to set certain settings to a certain value globally.

For example, set all the belongs_to fields to have the searchable value to true.

Explorations

  config.default_settings = {
    fields: {
      belongs_to: {
        searchable: false,
        polymorphic_as: false,
        relation_method: false,
      }
    },
    "fields.belongs_to.searchable": false,
    "fields.belongs_to.polymorphic_as": false,
    "fields.belongs_to.relation_method": false,
  }


@searchable = default_attribute("fields.belongs_to.searchable", args[:searchable] == true)
@polymorphic_as = default_attribute("fields.belongs_to.polymorphic_as", args[:can_create].nil? ? true : args[:can_create])


      def default_attribute(key, default)
        if value_exists?(key)
          value(key)
        else
          default
        end
      end

Metadata

Metadata

Assignees

No one assigned

    Labels

    ConfigurationEnhancementNot necessarily a feature, but something has improvedTaskSomething to get done

    Type

    No type

    Projects

    Status

    Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions