ActionView::Template::Error: can't dump File

99 views Asked by At

Recently we had the error while upgrading flipper gem Removes:dalli_store. Use Rails' official:mem_cache_store instead. https://guides.rubyonrails.org/caching_with_rails.html. So we changed cache store from dalli to mem_cache_store. After upgrade, we are facing an issue with the following code

def self.for_user(user)
   Rails.cache.fetch(data_completeness_cache_key(user.id), expires_in: 10.minutes) do
     return [] unless user.is_a_patient?
      
     cache_compute
   end
end

where cache_compute returns an array of objects.

Stacktrace:

 Minitest::UnexpectedError: ActionView::Template::Error: can't dump File

        appsules/data_completeness/services/calculate_data_completeness.rb:22:in `for_user'

        appsules/data_completeness/services/calculate_data_completeness.rb:32:in `complete_for_user?'

        app/helpers/application_helper.rb:691:in `data_donation_tray_props'

        app/helpers/application_helper.rb:741:in `navbar_props'

        app/views/layouts/_header.html.haml:29

        app/views/layouts/nav.html.haml:20

        app/views/layouts/nav.html.haml:17

        app/controllers/application_controller.rb:276:in `handle_insufficient_privileges'

        app/controllers/application_controller.rb:72:in `block in <class:ApplicationController>'

        test/controllers/api/v3/profiles_controller_test.rb:102:in `block (2 levels) in <class:ProfilesControllerTest>'
    appsules/data_completeness/services/calculate_data_completeness.rb:22:in `for_user'
    appsules/data_completeness/services/calculate_data_completeness.rb:32:in `complete_for_user?'
    app/helpers/application_helper.rb:691:in `data_donation_tray_props'
    app/helpers/application_helper.rb:741:in `navbar_props'
    app/views/layouts/_header.html.haml:29
    app/views/layouts/nav.html.haml:20
    app/views/layouts/nav.html.haml:17
    app/controllers/application_controller.rb:276:in `handle_insufficient_privileges'
    app/controllers/application_controller.rb:72:in `block in <class:ApplicationController>'
    test/controllers/api/v3/profiles_controller_test.rb:102:in `block (2 levels) in <class:ProfilesControllerTest>
0

There are 0 answers