How to remove breadcrumbs while using Active Admin gem in Rails?

I am using Active admingem and want to remove the panel breadcrumbsfrom Admin. For this, I called this blog to configure TitleBar.

I have taken the following steps:

  • Created my own class MyTitleBarand copied the contents of the class TitleBarfrom active_admin/views/title_bar.rb.
  • Deleted a line build_breadcrumbin a method build_titlebar_left.
  • The whole method has been deleted build_breadcrumb.
  • Updated active administrative config as:

    config.view_factory.title_bar = MyTitleBar

This works great.

My questions:

  • Is this the right way to achieve the above objective?
  • Also, is there a way to remove breadcrumbsmodel-wise?
+4
1

, , , . , Gamer ActiveAdmin - breadcrumb:

ActiveAdmin.register Post do

  breadcrumb do
    [
      link_to('my piece', '/my/link/to/piece')
    ]
  end
end

, , links. TitleBar:: build_breadcrumb, , links breadcrumb_links(). , - , . .

, , , nil empty. , - . , nil, links.present? , HTML-. , , - . , , .

/config/initializers/active_admin.rb:

# Return a Proc that simply returns an empty array
config.breadcrumb = Proc.new{ [] }
+8

All Articles