I am having an issue launching sidekiq from the CLI. The current Error is:
`uninitialized constant ConfirmationEmailWorker::SideKiq
/Users/alexfroelich/Desktop/project/app/workers/confirmation_email_worker.rb:2:in `<class:ConfirmationEmailWorker>'
/Users/alexfroelich/Desktop/project/app/workers/confirmation_email_worker.rb:1:in `<top (required)>'
/Users/alexfroelich/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.1.0/lib/rails/engine.rb:468:in `block (2 levels) in eager_load!'
/Users/alexfroelich/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.1.0/lib/rails/engine.rb:467:in `each'
/Users/alexfroelich/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.1.0/lib/rails/engine.rb:467:in `block in eager_load!'
/Users/alexfroelich/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.1.0/lib/rails/engine.rb:465:in `each'
/Users/alexfroelich/.rvm/gems/ruby-2.0.0-p247/gems/railties-4.1.0/lib/rails/engine.rb:465:in `eager_load!'
/Users/alexfroelich/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-3.0.0/lib/sidekiq/cli.rb:213:in `boot_system'
/Users/alexfroelich/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-3.0.0/lib/sidekiq/cli.rb:42:in `parse'
/Users/alexfroelich/.rvm/gems/ruby-2.0.0-p247/gems/sidekiq-3.0.0/bin/sidekiq:7:in `<top (required)>'
My config/application.rb
looks like the following as I was reading that eager_loading, auto_loading might do the trick (although it seems repetitive as rails loads everything in app/
)
require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "sprockets/railtie"
# require "rails/test_unit/railtie"
# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(:default, Rails.env)
module App
class Application < Rails::Application
# Settings in config/environments/* take precedence over those specified here.
# Application configuration should go into files in config/initializers
# -- all .rb files in that directory are automatically loaded.
console do
require 'pry'
config.console = Pry
end
config.generators do |g|
g.stylesheets false
g.migration false
g.javascripts false
g.test_framework :rspec, fixture: false
g.template_engine false
end
config.autoload_paths += %W(#{config.root}/app/workers)
config.eager_load_paths += %W(#{config.root}/app/workers)
config.before_configuration do
env_file = File.join(Rails.root, 'config', 'mailer.yml')
YAML.load(File.open(env_file)).each do |key, value|
ENV[key.to_s] = value
end if File.exists?(env_file)
end
# Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
# Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
# config.time_zone = 'Central Time (US & Canada)'
# The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
# config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
# config.i18n.default_locale = :de
end
end
Located in the app/workers
folder i have the following file confirmation_email_worker.rb
class ConfirmationEmailWorker
include SideKiq::Worker
def perform
DairyMailer.order_confirmation.deliver
end
end
Pretty stumped on this one..So any guidance is welcomed! Thanks
Sidekiq
is all one word, lowercase.
Remove the capital letters.
include Sidekiq::Worker