Myapp :: Application :: Railties常常缺少Rails 4 beta和Jruby jruby-1.7.2

时间:2013-01-25 18:09:40

标签: jruby jrubyonrails ruby-on-rails-4

在没有黑客攻击的情况下,我无法使用Rails 4:

在railties / lib / rails / engine.rb中,我不得不用const_get初始化Railties,否则

def railties
  @railties ||= self.class.const_get(:Railties).new
  # @railties ||= self.class::Railties.new
 end

否则我明白了:

./仓/耙 耙子流产了! 未初始化的常量Myapp :: Application :: Railties org / jruby / RubyModule.java:2677:in const_missing' /Volumes/Opt/rails/rails-edge/railties/lib/rails/engine.rb:469:in railties' /Volumes/Opt/rails/rails-edge/railties/lib/rails/application.rb:241:in run_tasks_blocks' /Volumes/Opt/rails/rails-edge/railties/lib/rails/engine.rb:444:in load_tasks' org / jruby / RubyBasicObject.java:1659:in __send__' org/jruby/RubyKernel.java:2086:in发送' /Volumes/Opt/rails/rails-edge/railties/lib/rails/railtie/configurable.rb:30:in method_missing' /Volumes/Opt/projects/myapp/Rakefile:6:in(root)' org / jruby / RubyKernel.java:1046:在'load'

由于同样的原因,Rails本身无法启动。这是正确的修复还是我掩盖了一些潜在的问题?

2 个答案:

答案 0 :(得分:3)

并没有真正解决问题,但我添加了

Rails::Engine.class_eval do
  def railties
    @railties ||= self.class.const_get(:Railties).new
  end
end
<{1>}位于Bundler.require下方,以避免更改原始文件。

答案 1 :(得分:0)

这似乎已经通过对Rails master(对引擎的小改动)的提交得到修复:https://github.com/rails/rails/commit/45aabe61520cbb4bd74f6de7dc1023d2ca071e40

我刚补充说:

gem 'rails', :git => 'git://github.com/rails/rails.git'  

或只是

gem 'rails', github: 'rails/rails'

到我的Gemfile下拉最新版本的Rails,这就行了。能够删除Alex的(很好 - 谢谢你!)黑客,它一切正常。