I created a module with some utility classes. A class from this module is instantiated from one of my controller several times :
class Admin::Statistic::StatisticsController < Admin::Statistic::ApplicationController
def index
@data_global_turnover = Elasticsearch::Graphes::Graph::Drilldown.new(model: :order, request_params: {nature: :total_turnover, year: 2016}).classic
@data_average_basket = Elasticsearch::Graphes::Graph::Drilldown.new(model: :order, request_params: {nature: :avg_basket, year: 2016}).classic
end
The first call is working, but on the second call I get :
uninitialized constant Elasticsearch::Graphes::Graph::Drilldown
How is it that the constant can be initialized on the first call and not on the second one ? How do I fix that ?