For anyone hitting the same wall to read, the solution to this is to strictly respect Rails autoloading rules. That is
- Removing all the require / require_relative
- Add needed paths to Rails autoload paths
- Put files at the right places with the right names so Rails can infer where to look for code to load.
More info here: https://github.com/rails/rails/issues/15767