ActiveAdmin: Turning Hashes/ActiveRecord Hashes to Field Values
After I installed ActiveAdmin gem, everything worked great except I had an issue where the dropdown menus were showing ActiveRecord hashes like this:
Instead of showing a name like the other fields. It seems that the default is to show a field called “name” in the dropdown menus in ActiveAdmin, and if you don’t have such a field it shows the ActiveRecord instead. Changing that was easy, after I found this StackOverflow question.
All you have to do is go into the model and add a method for to_s, like this:
# field name you want to show in the drop down
for me, I put:
Comments are closed.