Skip to content

visible and hide option for a field in base section get overridden in children sections #3730

@phanbaominh

Description

@phanbaominh

Describe the bug
When setting the visible or hide option for a field in using configure block in the base section, the options will be overridden in the children sections e.g show/edit/list if we explicitly declare the field.
Reproduction steps

config.model "User" do
  configure :email do
    hide { true }
  end

  edit do
    field :email
  end
end

email will NOT be hidden the edit section
Expected behavior
hide option should be applied for the email field in the edit section and be hidden.
Other option e.g pretty_value doesn't get this problem and work as expected
Additional context

  • rails version: 7.1.5.2
  • rails_admin version: 3.2.0

This is probably caused by this field.show at

field.show if field && !field.instance_variable_get("@#{field.name}_registered").is_a?(Proc)
which is still present in the latest version.
Is it possible to add an additional constraint that @visible_registered have not been defined before calling field.show

Side note: I looked through the code and did not see where this @#{field.name}_registered instance variable is set, not sure if the !field.instance_variable_get("@#{field.name}_registered").is_a?(Proc) is still relevant.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions