Rails ActiveAdmin: Incorrect breadcrumb

1.9k Views Asked by At

I have model called Part which is using ActiveAdmin, CRUD operation works fine but the breadcrumb is not generating properly. Here is what I am getting in the breadcrumb on the EDIT page

 Admin / Parts / #<Part:0xcd74ef0> / 

I am using "activeadmin", "0.5.0"

3

There are 3 best solutions below

0
On

In Active Admin for Custom breadcrumb

Try to define display_name in your Part model.

class Part < ActiveRecord::Base
  // Some Code
  def display_name
    "#{ id } #{ name }"
  end
end
0
On

You can use to_s method.

Define to_s method in Part model.

class Part < ActiveRecord::Base
  def to_s
    attribute_name.to_s
  end
end
0
On

Try this.. this might help someone..

ActiveAdmin.register Post do

   breadcrumb do
     [
       link_to('Admin', admin_root_path),
       link_to('My Resource', admin_<resource>_path),
     ]   
   end 
end