简体   繁体   English

使用puma将rails4应用程序从MRI移植到JRuby,没有运气

[英]Porting a rails4 app from MRI to JRuby with puma, no luck

I'm developing a rails 4.0.0.beta1 app on MRI 2.0.0 and all looks working. 我正在MRI 2.0.0上开发Rails 4.0.0.beta1应用程序,并且看起来一切正常。 I would like to try to run it on JRuby with puma. 我想尝试在带有puma的JRuby上运行它。

$ ruby -v
jruby 1.7.3 (1.9.3p385) 2013-02-21 dac429b on Java HotSpot(TM) 64-Bit Server VM 1.6.0_45-b06-451-11M4406 [darwin-x86_64]

I changed my Gemfile this way: 我以这种方式更改了我的Gemfile:

if defined?(JRUBY_VERSION)
  gem 'activerecord-jdbc-adapter', :require => false
  gem 'jdbc-mysql'
  gem 'puma'
else
  gem 'mysql2'
  gem 'thin', '1.5.1'
end

and I did bundle install (all ok). 我做了捆绑安装(一切正常)。

When I try to run puma with 当我尝试与

$ bundle exec puma

I'm getting this error: 我收到此错误:

Puma 2.0.1 starting...
* Min threads: 0, max threads: 16
* Environment: development
* Listening on tcp://0.0.0.0:9292
NameError: uninitialized constant Foo::Application::Railties

I tryed to google but I couldn't find any information about the error, someone has an idea how to fix this? 我尝试使用google,但找不到有关该错误的任何信息,有人知道如何解决此问题?

Thank you 谢谢

Finally I found (luckly), I think it's a rails's problem on rc1, to solve it put this in your Gemfile 最后,我发现(幸运的是),我认为这是rc1上的rails问题,要解决此问题,请将其放入您的Gemfile

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

Then you will get another error 然后你会得到另一个错误

NameError: uninitialized constant ActionDispatch::Session::EncryptedCookieStore

You can solve this changing your 'initializers/session_store.rb' to 您可以解决将“ initializers / session_store.rb”更改为

Foo::Application.config.session_store :cookie_store, key: '_foo_session'

(pay attention at your app's name in the correct place, don't use 'Foo') (请注意您应用的名称在正确的位置,请勿使用“ Foo”)

Enjoy! 请享用!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM