I'm using rails admin, and I need to display fields in the show action if they are blank as well as if they are populated.
show do
field :name
field :key
field :description
field :type
end
At the moment, if description is empty (which is allowed) it will only display name, and fields. I need it to display all 3 fields regardless of if they are populated or not.
Update: Pictures
Example with empty description field:
Example with populated description field:
Thanks
CodePudding user response:
Whenever rails admin detects a falsy value it does not show the field, so an empty string or nil would hide it. You have to give it a non falsy value as a default like this
show do
field :name
field :key
field :type
field :description
formatted_value do
value || '-'
end
end
end