Using forest_liana gem in a rails 6 app we have created a smart action that excepts an array of integers as a parameter.
We need to call this from javascript code in a smart view, and the current implementation overrides the triggerSmartAction
function, e.g:
@action
triggerSmartAction(...args) {
args[2] = [1,2,3,4];
return triggerSmartAction(this, ...args);
}
The rails controller action will then receive that data in the parameters:
Parameters: {"data"=>{"attributes"=>{"collection_name"=>"MyCollection", "values"=>{}, "ids"=>[1,2,3,4], etc...}
This is a hack though. I have not seen any other valid alternatives??
Anyway, this does work, but only if the smart view is accessed directly from that collection.
If it is accessed through a parent collection, the parameters received become e.g:
Parameters: {"data"=>{"attributes"=>{"collection_name"=>"MyCollection", "values"=>{}, "ids"=>[], "parent_collection_name"=>"MyCollectionParentCollection", "parent_collection_id"=>"1", etc...}
And the data we need from the ids
param is no longer present.
Is there a workaround for this?
Many thanks
Context
Rails 6.1.3.1
Forest liana gem 6.3.1