Smart segment not showing in Forest UI (Rails)

Hi there!

I’m trying to add a Smart Segment in Forest. I’m using Rails with Forest Liana 7.6.7

I added a folder in /lib called forest_liana then a folder collections and created a file shares_purchase.rb (name of one of my models).

I then used the code on Smart Segments - Developer guide ad model to create a Smart Segment :

class Forest::SharesPurchase
  include ForestLiana::Collection

  collection :SharesPurchase

  segment "Potential duplicates" do
    duplicates_id = SharesPurchase.where(amount: 1)

    { id: duplicates_id }

The Smart Segment doesn’t appear in Forest UI (even as a hidden collection).

Can you please tell me what I am doing wrong? Thanks!


  • Project name: Time for the Planet
  • Team name: Operation
  • Environment name: Development
  • Agent type & version: Forest Liana

Hi @manu_e and welcome in our community :champagne: !!!

If it’s not in the .forestadmin-schema.json file then it means it has not been coded correctly or you are not generating the .forestadmin-schema.jsonautomatically. I will send you someone who will be more suited to help you :wink:

Hello @manu_e

Your shares_purchase.rb file looks good.
Have you tried refreshing the forest UI?

You could also force the update of your apimap with the command :
rails forest:send_apimap