The structure is as follows:

- app - services - add_xlsx_file.rb - routes.rb - models.rb - helpers - xlsx_helpers.rb - app.rb 

In app.rb :

 require 'rubygems' require 'sinatra' require './sinatra/xlsx_helpers' helpers Sinatra::XlsxHelper Dir.glob('./{app,config}/*.rb').each { |file| require file } Dir.glob('./app/services/*.rb').each { |file| require file } 

In routes.rb , the service is called:

 post '/clients' do # ... XlsxFile.new(client).call end 

In the service class itself, the #initialize_xlsx_file method is #initialize_xlsx_file . The method itself is written in the XlsxHelper helper.

Those. defined in helpers / xlsx_helpers.rb , called in services / add_xlsx_file.rb

#initialize_xlsx_file not visible in services. Error undefined method initialize_xlsx_file There are no require services, I haven’t connected anything. Not from what these classes are not inherited.

In routes.rb, this method works well.

  • It is not very clear where the initialize_xlsx_file method is defined, where and how is it called? - cheops
  • defined in helpers / xlsx_helpers.rb , called in services / add_xlsx_file.rb - evans
  • There are no require services, I did not connect anything. Not from what these classes are not inherited. - evans

0