I’m trying to get my head around Rails and ActiveAdmin, and string representations of objects. Particularly, I’m struggling to define a single method that’ll get picked up by Rails (in the templates) and ActiveAdmin.
If I do something like:
def to_s
"Hello world"
end
Then that works in Rails. But not in ActiveAdmin, which only picks it up if I use display_name. It’s solved by doing this:
alias_attribute :to_s, :display_name
But is that a bit hacky? Just wondering if I’ve missed something obvious. Thanks!
In the end, I used: