Hi all,
After added this following on cors.rb to fix an issue during the authentication:
allow do
origins 'app.forestadmin.com'
resource '*', headers: :any, methods: :any, expose: ['Content-Disposition'], credentials: true
end
I’m now running into a new issue, still during the setup: to handle rich texts on some of our models, we recently installed Action Text. The setup creates a new table called action_text_rich_texts
. It seems it is not recognized by Forest Admin as a model because it raises the following error:
Forest
Records Index error: undefined method
[]' for nil:NilClass /ruby/gems/2.6.0/gems/forest_liana-7.4.5/app/controllers/forest_liana/application_controller.rb:113:in
force_utf8_attributes_encoding’
I checked on your source code and it’s coming from this method:
def force_utf8_attributes_encoding(model)
# NOTICE: Declare all strings are encoded in utf-8
if model['attributes']
model['attributes'].each do |name, value|
if value.respond_to?(:force_encoding)
begin
model['attributes'][name] = value.force_encoding('utf-8')
rescue
# NOTICE: Enums are frozen Strings
end
end
end
end
end
model
is nil
and raises that error: is it because ActionText::RichText
model is not recognized as a true model by Forest Admin?
Here the params I get from the last request before it fails:
{"fields"=>{"ActionText__RichText"=>"body,created_at,id,name,record_id,record_type,updated_at"}, "searchExtended"=>"0", "timezone"=>"Europe/Paris", "collection"=>"ActionText__RichText"}
By the way in my logs, I get the following error:
Infos related to my app:
- Project name: WEB-APP MP
- Rails 6.0.3.4
Thanks for your help!