New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NameError: uninitialized constant {class} #2084
Comments
I have no idea what's causing this. But based on my experience this usually indicates a problem loading RandomLogo, i.e. one of its dependencies can't be loaded. |
RandomLogo class has no dependencies and it's a pretty simple class Here is the entire source code: lib/random_logo.rb class RandomLogo
COLORS = %w[
5D9CEC
4A89DC
4FC1E9
3BAFDA
48CFAD
37BC9B
A0D468
8CC152
EC87C0
D770AD
AC92EC
967ADC
ED5565
DA4453
FC6E51
E9573F
FFCE54
F6BB42
656D78
434A54
CCD1D9
AAB2BD
AB988C
8E7E74
]
LETTERS = ("A".."Z").to_a + ("0".."9").to_a
SIZES = {
original: '400x255',
large: '147x92',
profile: '122x77',
identity: '79x50',
contact: '58x39',
thumb: '65x65#',
small: '250x160#',
regular: '298x190#',
extra_large: '400x255#'
}
class << self
def path(size = :original, letter = nil, color = nil)
letter ||= random_letter
color ||= random_color
"logo.#{size}.#{letter.upcase}.#{color}.png"
end
def random_letter
LETTERS.sample
end
def random_color
COLORS.sample
end
end
end |
Have you tried moving it into app/models and seeing if it just starts working? |
No, I have not. I will try and post results. |
Ok, I'm gonna close this issue. At the end, it was not related to Sidekiq. It seems that one of our Capistrano tasks was not restarting Sidekiq properly in some of our servers. As result, we were running old code (facepalm). Thanks! |
Hi all!
I've been fighting with
NameError: uninitialized constant {class}
lately at my company. It seems to be related to Why doesn't Sidekiq autoload my Rails application code?, but including thelib
dir inconfig.eager_load_paths
and/or settingconfig.eager_load = true
didn't solve the issue.I even try to
require
directly the class inconfig/application.rb
, with no success. I've checked if the naming of the code/files was not following the proper naming convention, but it seems everything is right.These are examples of the files/classes involved:
Gemfile
config/application.rb
lib/random_logo.rb
config/initializers/paperclip_interpolations.rb
app/workers/my_worker.rb
In addition:
The text was updated successfully, but these errors were encountered: