I am using sidekiq gem in rails 3 and I have define a foo_workers.rb in app/workers folder, when I try to call FooWorker.perform_async(@article) in a rails controller named articles I get this error,
uninitialized constant ArticlesController::FooWorker
Can anyone please help me.
Check your pluralization. The file is called foo_workers.rb, which means you're probably defining FooWorkers, not FooWorker. It should be singular. But this is all guessing because you didn't actually post any code.
The autoload mechanism won't pluralize your class names. So the class FooWorker is expected to be defined in a foo_worker.rb file in some of the autoload paths.
If the file name is different (like foo_workers.rb), Rails won't try to load the class from it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With