Forest Admin
Forest Admin is the admin portal mainly used by the sales & marketing teams.
It's super easy to link it to your Rails app with this gem:
As always, I strongly recommend to read their document as it is super complete. If you're stuck, feel free to submit a question on their dedicated forum, the support is quite reactive. And, it's Belgian tech for once π§πͺ
Still, let's focus on some key concepts to help you get ahead!
Collections
ForestAdmin sees models as colletions basically, so if you want to display candidates in the admin, you'll have a collection candidate.
Those are defined in the lib/forest_liana/collections folder in our app.
Here is a simplified example of our Recruiter collection:
We can observe multiple things here:
it includes
::ForestLiana::Collection(from the gem)it defines the collection
it defines a "custom field" => godview, which is an URL (so a string)
it defines a "custom action" => add note
Routes
You can define custom route for ForestAdmin, to get custom data or to execute custom actions for example.
Those routes must be declared in the :forest namespace. This means that the final route in this example is: "forest/actions/recruiter/add-note"
Run it locally
You need to develop a new feature for ForestAdmin? You can run it locally to directly test your feature on a "local" ForestAdmin.
The process is detailed in their doc, just don't use Brave or any other anarchist browser, else you might never succeed in running it locally.
To run it locally, they'll add some variables to your .env(it might be done by the installer without your notice). One of this variable (DATABASE_URL) will need to be removed when you don't need ForestAdmin in local anymore, as it'll break you specs if you keep it.
More on that in the tips & tricks section.
Push the .forestadmin-schema.json
This file reflects your local environment, and will (re)generates when you start yout server.
This allows FA to know our models and work correctly, and it should probably never be edited manually.
This file will always look at your local setup & DB to generate, so it can be problematic if you:
On branch 1, run a migration to create a new table
Switch to branch 2 which does not contain the migration (and branch 1 is still in dev)
The forestadmin file contains the change of the migration from you other branch, because your local DB is already migrated regardless of the branch you're on
So if you release branch 2 before branch 1, make sure to reset your DB and re-start your server so the file can re-generate properly and you can safely push.
Last updated