简体   繁体   中英

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM