I couldn't get jruby to work with Rails 4 without a hack:
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 this:
./bin/rake
rake aborted!
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 won't start up for the same reason. Is this the correct fix or did I mask some underlying problem?
Doesn't really solve the problem 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
to avoid having to change the original files.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With