Field called 'campaign id' not showing value

Using the collections search. I am searching by ‘campaign id’ which is actually a campaign code not a specific ‘id’ field.

On the search results, the campaign id field is not populated, however, the search works and is locating the correct objects

  • Project name: Ibex
  • Team name: Development
  • Environment name: Production
    Screenshot 2022-08-19 at 15.36.43

Hi @ed.sparks,

Could you share a screenshot of your browser console with the request parameters and the response ?

It appears that the response doesn’t include ‘campaign_id’ (search returned no result) as a field. I imagine this is down to an expectation that a field like this would be the actual database ID, not a text field?


I’m not able to reproduce the issue.

Could you share your campaign model and the full (uncropped) response?

That was the response.

What format would you like the campaign model in?

{"data":[{"type":"Campaign","id":"1672","attributes":{"id":1672,"title":"DISH","description":null,"budget":2260000,"spend":1464900,"created_at":"2022-08-19T15:50:24.669+01:00","updated_at":"2022-08-19T15:50:24.669+01:00","imported?":false,"data_uploaded":false,"start_date":"2018-08-07","end_date":"2018-12-09","latitude":null,"longitude":null,"country":null,"options":{"content":{"data":[],"view":true},"published":{"view":false},"cost_metric":{"data":[],"view":false},"import_errors":[],"campaign_media":{"view":true},"ext_cost_metric":{"data":[],"view":true},"campaign_details":{"view":true},"influencer_images":{"view":true},"guaranteed_content":{"view":true},"performance_metric":{"data":[],"view":true},"guaranteed_cost_metrics":{"view":true},"guaranteed_performance_metrics":{"view":true}},"last_imported":null,"exchange_rate":null,"status":null,"last_int_approval_message":null,"last_ext_approval_message":null,"dashboard_published":null,"last_campaign_list_added":null,"last_channel_added":null,"last_notification_sent":null,"google_sheet_id":null,"campaign_links":[["INT C.S","https://docs.google.com/spreadsheets/d/1DcfHbezkjogn5aWcPivhSGd-Ka3mIosZ0pH2GzkglS0/edit"]],"original_google_sheet_id":null},"links":{"self":"/forest/campaign/1672"},"relationships":{"client":{"links":{"related":{}},"data":{"type":"Client","id":"577"}},"campaign_type":{"links":{"related":{}},"data":null},"currency":{"links":{"related":{}},"data":null}}}],"included":[{"type":"Client","id":"577","attributes":{"name":"DISH"},"links":{"self":"/forest/client/577"}}],"meta":{"decorators":null}}

Could you share the definition of your Campaign.rb model ?

Screenshot 2022-08-22 at 15.47.26
I can’t share the entire thing but this is hopefully enough

You can’t share your app/models/campaign.rb ?

I’m not allowed to, no.
There’s nothing in there that should affect this. Unless you are looking for something in particular?

Have you a getter method campaign_id that could affect the response of the model?

Have you tried the search on another field ? Does it work ?

Also could you run the rails console and tried this query :pray: :

Campaign.where("LOWER(campaign_id) LIKE :search", search: '%DISH001%'.downcase)

Hey Nico,

Thank you for working around the restrictions I have. Much appreciated.
There’s no custom methods related to campaign_id in the model and the query you sent works as expected and returns the correct results.

The search facility on forest admin also returns the correct result but just doesn’t seem to make the values of that field visible. V odd

In your rails app, do you have this file : lib/forest_liana/collections/Campaign.rb ?

If it exists, can you share it?

I don’t unfortunately.
I have the schema if that’s helpful?

Well, it might be an issue on the render behaviour.

Do you have a controller in your lib/forest_liana/controllers that override the route forest/Campaign ?

I don’t have a ‘lib/forest_liana/controllers’ folder nor a ‘lib/forest_liana’ folder. I don’t think I’ve applied any customisations to the setup either.

Hi,

Is the issue appear on both environnement (dev / prod) ?

Eventually could you try updating your forest_liana gem to version v7.6.13 ?

I have upgraded to v7.6.13 and have tried both the development and production environments. Still the same unfortunately.

Unfortunately, we don’t have any other solutions.

So I would recommend to investigate inside the forest liana gem.

Could you install the gem locally (GitHub - ForestAdmin/forest-rails: 💎 Ruby on Rails agent for Forest Admin to integrate directly to your existing Ruby on Rails backend application.).

You have to update this line: ‘gem ‘forest_liana’, path: “YOUR_PATH/forest-rails”’ in your Gemfile and run bundle command.

We need to add some breakpoints to look what happen in the query, could you put a “debugger” at the corresponding lines of your local gem: