RailsDispatcher and files in "lib"
Andre Nathan <[email protected]> Thu, 04 Jan 2007 00:06:32 -0200
| Newsgroups | gmane.comp.apache.mod-ruby |
|---|---|
| Message-ID | <1167876393.5022.11.camel@localhost> |
Hello I have Rails running under mod_ruby, with the RailsDispatcher. I've come into a problem while trying to run ozimodo (ozimodo.rubyforge.org). Basically, it comes down to the fact that apparently libraries stored in the "lib" dir of a Rails application are not being correctly required by RailsDispatcher. The error I'm getting is the following: [Wed Jan 03 23:53:27 2007] [error] mod_ruby: /usr/lib/ruby/1.8/apache/rails-dispatcher.rb:262:in `eval': /usr/lib/ruby/1.8/apache/rails-dispatcher.rb:441:in `const_missing': uninitialized constant Ozimodo (NameError) The "Ozimodo" module is defined in lib/ozimodo/type_parser.rb. In the RailsDispatcher code, the "require_or_load" method from ActiveSupport's Dependencies module is overwritten to account for the mod_ruby environment. The argument to this method is a filename to be loaded, and in this case, it's being passed the string "apache/rails_dispatcher/current_module/ozimodo". The method "require_file" ends up being called, which appends ".rb" to the filename, and tries to load it (it fails, because the file doesn't exist) and then tries to require it, which also fails. I'm not sure what would be the correct solution, but it seems that if the argument given to require_or_load is a directory, the method should search for the .rb files inside it, and then try to load/require them. Does that sound reasonable? Anyone else had problems with this? Thanks in advance, Andre