Artificial intelligent assistant

ActiveAdminでfriendly_idを使っているモデルのパンくずリストが別の物を指してしまう `code``Company``friendly_id` class Company < ActiveRecord::Base extend FriendlyId friendly_id :code, use: :slugged end `ActiveAdmin``friendly_id` ActiveAdmin.register Company do controller do def find_resource scoped_collection.friendly.find(params[:id]) end end end `edit``friendly_id` `friendly_id` ### <



`lib/active_admin/dsl.rb`


# Rewrite breadcrumb links.
# Block will be executed inside controller.
# Block must return an array if you want to rewrite breadcrumb links.
#
# Example:
# ActiveAdmin.register Post do
# breadcrumb do
# [
# link_to('my piece', '/my/link/to/piece')
# ]
# end
# end
#
def breadcrumb(&block)
config.breadcrumb = block
end




### app/admin/companies.rb


ActiveAdmin.register Post do
breadcrumb do
links = [link_to('Admin', admin_root_path), link_to('Companies', admin_companies_path)]
if %(show edit).include?(params['action'])
links << link_to(company.name, admin_company_path)
end
links
end
end

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 9be178d562497f376dd584bc700e4042