'intermittent uninitialized constant error in ruby

In one of my application, there are three tabs and when any of the tab is pressed, it shows some information by making a post call to corresponding service.

The controller for tab1 is as follows (Only small part is shown)

def tab1_results
  response = tab1_service_wrapper.get_tab1_result(params)

The controller for tab2 is as follows

def tab2_results
  search_params = JSON.parse(params[:searchParams])
  response = tab2_service_wrapper.get_tab2_result(search_params)

In each of the service wrappers we convert the input provided into JSON format and make a call to the respective services.

But recently I have observed that pressing tab1 repeatedly triggers the following error.

uninitialized constant ServiceInitializerModule::Tab1ServiceWrapper

This is observed only sometimes with tab1. This is not the case with tab2.

My question is can passing params directly to downstream be the cause for this issue?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source