The route through the slug field and not id see:

The correct would be:
/admin/customers/1/edit
My controller:
module Admin
class CustomersController < Admin::ApplicationController
end
end
My dashboard:
require "administrate/base_dashboard"
class CustomerDashboard < Administrate::BaseDashboard
ATTRIBUTE_TYPES = {
company: Field::BelongsTo,
id: Field::Number,
name: Field::String,
slug: Field::String,
created_at: Field::DateTime,
updated_at: Field::DateTime,
contract_start_at: Field::DateTime,
contract_end_at: Field::DateTime,
observation: Field::Text,
logo: Field::String,
cnpj: Field::String,
}.freeze
COLLECTION_ATTRIBUTES = [
:company,
:id,
:name,
].freeze
SHOW_PAGE_ATTRIBUTES = [
:company,
:id,
:name,
:slug,
:created_at,
:updated_at,
:contract_start_at,
:contract_end_at,
:observation,
:logo,
:cnpj,
].freeze
FORM_ATTRIBUTES = [
:company,
:name,
:slug,
:contract_start_at,
:contract_end_at,
:observation,
:logo,
:cnpj,
].freeze
end
Thak you for support.
Probably you are using the FriendlyId gem.
Maybe you can solve this problem uncommenting the following code in your model:
app/controllers/admin/your_model_controller.rb
Define a custom finder by overriding the `find_resource` method:
def find_resource(param)
YourModel.find_by!(slug: param)
end
worked with:
def find_resource(param)
Customer.find_by!(slug: param)
end
thank you
This issue can be closed?
@GeoffAbtion Yeah, I think you can close this issue. @rodrigovirgilio how about you?
Yes, you can close it.
Most helpful comment
worked with:
thank you