`
fsword
  • 浏览: 164955 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

打开jruby+rails3的多线程开关

阅读更多

前两天把项目的设置改了一下,添加了 threadsafe=true,结果发现平时开发环境出现很多奇怪的错误

ActiveRecord::HasManyThroughSourceAssociationNotFoundError (Could not find the source association(s) :app in model Stakeholder.  Try 'has_many :apps, :through => :stakeholders, :source => <name>'.  Is it one of :user?):
  app/controllers/base_controller.rb:8:in `current_app'
  app/controllers/machines_controller.rb:4:in `index'

#相关代码
class BaseController < ApplicationController
  before_filter :authenticate_user!
  def current_app
    current_user.apps.where(:id => params[:app_id]).first||App.new
  end
end

 

而这里的模型间关系之前一直没有错误,很诡异。

这个问题的根本原因目前还不清楚,但是我后来发现,如果不使用webrick,转用支持多线程的server来rackup这个应用就可以了,在jruby user邮件组,有人推荐我用 trinidad

 

$ gem install trinidad
$ trinidad --port 9999
......

 

试了一下,这个是个tomcat wrapper,感觉还不错,向大家推荐

1
1
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics