Skip to content

false values not displayed in show view when compact_show_view is set to true #2416

@benhutton

Description

@benhutton

I want to keep compact_show_view = true, which I understand to be defined as "anything non-nil should show up in show view"

I have a boolean field, and thus I want it to show up in show view when it is set to false:

> false.nil?
 => false

The show template does properly use #nil? as the check for whether or not to display values:

- unless values[index].nil? && RailsAdmin::config.compact_show_view

The problem is that the values array is constructed by calling #presence on the formatted_value:

values = fields.map{ |f| f.formatted_value.presence }

Unfortunately,

> false.presence
 => nil

so

> false.presence.nil?
 => true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions