我正在尝试为我的Rails应用程序在JRuby 1.5类路径中添加一个完整的文件夹。配置建议如下:"...将JRuby Wiki目录添加到config/environment.rb
中的JRuby类路径中:“
$CLASSPATH << "file:///#{File.expand_path(File.join(RAILS_ROOT, 'config'))}/"
这似乎对我不起作用。无论我把它放在Rails::Initializer.run
块的前面、后面还是里面都没有关系。不管发生什么,我都会得到:
/home/sean/src/sbruby/seo/config/environment.rb:45:NoMethodError: undefined method `<<' for nil:NilClass
/home/sean/apps/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rails-2.3.7/lib/rails/backtrace_cleaner.rb:2:NameError: uninitialized constant ActiveSupport::BacktraceCleaner
/home/sean/apps/jruby/jruby-1.5.0/lib/ruby/gems/1.8/gems/rails-2.3.7/lib/console_with_helpers.rb:5:NameError: uninitialized constant ApplicationController
例如,我试图在RAILS_ROOT
下添加一个名为resources/foobar
的文件夹,因此我在environment.rb
中添加了以下内容
$CLASSPATH << "file:///#{File.expand_path(File.join(RAILS_ROOT, "resources", "foobar"))}/"
同样的错误。
使用Rails将文件夹添加到JRuby类路径的正确方法是什么?
https://stackoverflow.com/questions/3190877
复制相似问题