[英]Sidekiq Install - uninitialized constant ActiveRecord::Base (NameError)
I am trying to integrate Sidekiq with my Rails Mongoid app. 我正在尝试将Sidekiq与我的Rails Mongoid应用程序集成。 I have been following the steps as outlined Here 我一直按照此处概述的步骤进行操作
I also have redis & mongodb running locally. 我也有在本地运行的redis和mongodb。 However after I run bundle then when I try to start my server I get this error.... 但是,在运行包之后,当我尝试启动服务器时,出现此错误...。
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)>'
My environment.rb file is as follows... 我的environment.rb文件如下...
# Load the rails application
require File.expand_path('../application', __FILE__)
# Initialize the rails application
App::Application.initialize!
I previously had resque with redis working with mongoid in this app, so its a sidekiq issue. 我以前曾在该应用程序中使用过Redis和Mongoid,因此这是一个补充问题。 I don't have a database.yml file since I am using mongoid. 由于我使用的是Mongoid,所以我没有database.yml文件。 I also added the steps for kiqstand but I am getting the same error. 我还为kiqstand添加了步骤,但出现了同样的错误。 Unsure how to resolve? 不确定如何解决?
Edit: I'm 90% sure its because Sidekiq is looking for ActiveRecord, however I removed ActiveRecord cause I'm using Mongo instead. 编辑:我有90%的把握是因为Sidekiq正在寻找ActiveRecord,但是我删除了ActiveRecord,因为我改用Mongo。 My application.rb has... 我的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
Now I just need to figure out how to tell sidekiq to not look for it? 现在我只需要弄清楚如何告诉sidekiq不要寻找它?
Lack of ActiveRecord was the issue, looks like there was a pull request - https://github.com/mperham/sidekiq/pull/1090 缺少ActiveRecord是问题所在,看起来像是请求请求-https://github.com/mperham/sidekiq/pull/1090
But that was rejected, so I just had to add ActiveRecord to my app and add a dummy database.yml file. 但这被拒绝了,因此我只需要向我的应用程序添加ActiveRecord并添加一个虚拟的database.yml文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.