Replacing Content Displayed in Active Admin Blank Slate
July 31, 2015
There are tons of Active Admin workarounds available in the net but there are very limited resource on manipulating the content to be displayed in the blank slate. One of it is the StackOverflow question which is not what I want. All I want is to replace/manipulate the content as displayed inside the blank slate instead of customizing it in per-page basis: Remove the “Create new” link.
There’s a question that was asked in Google Groups but it’s been few years but yet received any response, so I decided to create a monkey patch by overriding Active Admin source code. The code is placed in the /config/initializer folder of my Rails project as
blank_slate.rb so that the project loads up the patch file without any configuration to load up a lib folder.
By patching the
render_blank_slate function and removing the join between the blank slate message and the “Create One” link as returned in
Waiyan Yoon's sharing on web development. Follow on Twitter