Myapp :: Application :: There is no permanent connection with Rails 4 beta and Jruby jruby-1.7.2

I could not get jruby to work with Rails 4 without hacking:

In railties / lib / rails / engine.rb I had to initialize Railties with const_get, otherwise

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

Otherwise, I get the following:

./ben/ Rake rake interrupted! uninitialized constant 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 send' / 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: in `load '

Rails itself does not start for the same reason. Is this the correct fix or am I masking some basic issues?

+6
source share
2 answers

Actually the problem is not solved, but I added

 Rails::Engine.class_eval do def railties @railties ||= self.class.const_get(:Railties).new end end 

under Bundler.require in application.rb so as not to change the source files.

+3
source

It seems that this fix was fixed in the Rails host (a small change for the engine): https://github.com/rails/rails/commit/45aabe61520cbb4bd74f6de7dc1023d2ca071e40

I just added:

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

or simply

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

to my gemfile to pull out the latest version of Rails, and that did the trick. I managed to remove Alex (nice - thankyou!) Hack, and everything works as it should.

0
source

All Articles