A
A
Anton2016-05-31 22:04:20
Ruby on Rails
Anton, 2016-05-31 22:04:20

How to set custom breadcrumb field in ActiveAdmin?

I have a table with a title field and a number field.
The title field is not always filled, and the number field, on the contrary, is always filled.
By default, ActiveAdmin picks up the title from the table, and this results in an empty link in breadcrumbs that cannot be clicked.
If you set the value of the title field as NULL, then the problem with an empty link is solved - an ID appears in its place, but still not the same.
In general, how to force a value for breadcrumb in ActiveAdmin?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
J
jarosluv, 2016-06-01
@hummingbird

The easiest way is to define the display_name method in the model :

def display_name
  title.presence || number
end

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question