Issue on setup : conflict between Administrate gem & Forest Admin

Hello everyone,

I have some trouble with the installation of Forest Admin. During the setup, I’m facing an issue because my current app is using the Administrate gem for our admin interface. After added the forest_liana in my Gemfile and runnned bundle. I get the following error when executing rails g forest_liana:install :

app/dashboards/coverage_zone_dashboard.rb:14:in <class:CoverageZoneDashboard>': undefined method admin_partners_path’ for #Module:0x00007fb45efe1f40 (NoMethodError)

This is the first error but I presume others will come: I have several models that use the Administrate gem and that creates routes, dashboards, controllers, views etc. for all of them. It seems there is a conflict here between Administrate and Forest Admin: the installation of FA gem delete all routes related to Administrate.

Because the migration to Forest Admin will take place gradually, I need Administrate to work in parallel with FA.

Infos related to my app:

  • Project name: WEB-APP MP
  • Rails
  • Administrate 0.14.0

I hope I gave all necessary infos!

Thanks a lot for your help :slight_smile:

I’ve just figured it out!

Actually the error was coming from this remote_url:

id: Field::Number,
partner: Select2Field.with_options(
remote_options: true,
remote_url: Rails.application.routes.url_helpers.admin_partners_path(format: :json),
searchable: true,
include_blank: true,
searchable_fields: [‘name’, ‘common_name’, ‘address’, ‘city’, ‘owner_email’, ‘manager_email’, ‘manager_firstname’, ‘manager_lastname’, ‘owner_firstname’, ‘owner_lastname’, ‘zipcode’]

Since Forest Admin gem is installed, it seems (not sure yet) Rails changed its order to execute code: admin_partners_path was then not still known. I fixed that by converting the value of remote_url into lambda:

remote_url: lambda { Rails.application.routes.url_helpers.admin_partners_path(format: :json) }

It now works like a charm!

1 Like

Hello @raphael-allard,

What a good news. We were investigating.

Have a nice experience.

Kind regards,

1 Like