我正在尝试将Sidekiq与我的Rails Mongoid应用程序集成。我一直在遵循概述Here
的步骤我也有redis& mongodb在当地运行。但是在我运行bundle之后,当我尝试启动服务器时,我收到了这个错误....
c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/sidekiq-2.17.7/lib/sidekiq/rails.rb:4:in `hook_rails!': uninitialized constant ActiveRecord::Base (NameError)
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/sidekiq-2.17.7/lib/sidekiq/rails.rb:16:in `block in <class:Rails>'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `instance_exec'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:30:in `run'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:55:in `block in run_initializers'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `each'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/initializable.rb:54:in `run_initializers'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/application.rb:136:in `initialize!'
from c:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railties-3.2.13/lib/rails/railtie/configurable.rb:30:in `method_missing'
from C:/Users/example/Documents/Workspace/app/config/environment.rb:5:in `<top (required)>'
我的environment.rb文件如下......
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
App::Application.initialize!
我以前在此应用程序中使用redis与mongoid合作进行了resque,因此它是一个sidekiq问题。我没有database.yml文件,因为我使用的是mongoid。我还添加了kiqstand的步骤,但我得到了同样的错误。不确定如何解决?
编辑:我90%肯定它因为Sidekiq正在寻找ActiveRecord,但我删除了ActiveRecord,因为我使用的是Mongo。我的application.rb有......
# remove activerecord and run off of mongo only
#require 'rails/all'
#http://stackoverflow.com/a/9327651/1026266
%w(
action_controller
action_mailer
active_resource
rails/test_unit
sprockets
).each do |framework|
begin
require "#{framework}/railtie"
rescue LoadError
end
end
现在我只需要弄清楚如何告诉sidekiq不要寻找它?
答案 0 :(得分:0)
缺少ActiveRecord是个问题,看起来有拉动请求 - https://github.com/mperham/sidekiq/pull/1090
但是这被拒绝了,所以我只需要将ActiveRecord添加到我的应用程序并添加一个虚拟的database.yml文件。