Today I decided to reorganize big amount of user related models and I\'m having a problem with it.
Before I had such structure:
app/models/user.rb
ap
Update: This years Christmas present was the release of Ruby 2.5.0 with which this error won't happen anymore. With Ruby 2.5+ you will either get the constant you asked for or an error. For older Ruby versions read on:
Your User::File class is not loaded. You have to require it (e.g. in user.rb).
The following happens when ruby/rails sees User::Info and evaluates it (simplified; only User is defined yet).
User::Info is defined - it is not (yet)Info is defined - it is not (yet)uninitialized constant -> do rails magic to find the user/info.rb file and require itUser::InfoNow lets do it again for User::File
User::File is defined - it is not (yet)File is defined - it is (because ruby has a built in File class)!User::File but got ::File::FileWe observe that the rails magic, that automatically requires files for (yet) unknown constants, does not work for User::File because File is not unknown.