ruby-on-railsrubynamespacesrails-3-upgradescope-resolution

rails 3 using folder name as namspace throws uninitialized constant error


I'm trying to upgrade an app from rails 2.3 to 3.0 and it has a file

app/utility/interface/import/import_statistics_manager.rb

which contains

class Utility::Interface::Import::ImportStatisticsManager         
//code here  
end

I beleive Utility::Interface::Import are the folder names in its file path but used as namespaces

This code works fine in rails 2.3 but when I try to run with rails 3.0.6 it throws a NameError

Error message:
   uninitialized constant Utility
Exception class:
   NameError

FYI: rails 2.3 uses ruby 1.8.7 and rails 3.0.6 uses ruby 1.9.2

Please correct me if my understandings are not correct


Solution

  • For future reference (see comments on the question):

    It helped adding the complete app folder to the autoload paths.

    See this post for further info.