I'm having problems with the namespace of the module that I am including in the model.
in / app / models / car.rb
class Car include Search::Car end
in / lib / search / car.rb
module Search module Car include ActiveSupport::Concern # methods in here end end
in / config / application.rb
config.autoload_paths += Dir["#{config.root}/lib/**/"] config.autoload_paths += Dir["#{config.root}/lib/search/*"]
The strange thing is that I do not get any errors directly when starting the server. But if I update the browser after a while, I get this error:
Expected #{Rails.root}/lib/search/car.rb to define Car
The nature of the problem indicates that it has something to do with:
/config/environments/development.rb
config.cache_classes = false
I also tried putting the search.rb file directly in /lib , where I define Search :
module Search
What am I doing wrong?
UPDATE:
Well, it turns out that if I rename Search::Car to Search::CarSearch , it will work. Is it not possible to have modules with the same name in another realm?
Yeggeps
source share