Answer the question
In order to leave comments, you need to log in
What module and class filenames to use in Rails?
Good afternoon. It was required to connect the class to the web application. To do this, I added the line config.autoload_paths += %W( #{Rails.root}/app/services ) to the config/application.rb file. But the class stubbornly refused to be included until I renamed it from "someclass.rb" to "some_class.rb". What's the matter? Is it some sort of configuration convention or what?
Answer the question
In order to leave comments, you need to log in
You are right, this is such an agreement in rails, autoloading.
For example, when you refer to the MyModule::MyClass class, rails looks for my_module/my_class.rb in all folders specified in config.autoload_paths and if the file is found, then require.
By default, autoload_paths already contains all subdirectories of the app directory, that is, in your case, config/application.rb does not need to be edited
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question