我使用了carrierwave和file_size_validator 我正在使用sidekiq。 当我运行"捆绑exec sidekiq"在控制台 我看到了这个错误
/lib/file_size_validator.rb:5: warning: already initialized constant FileSizeValidator::MESSAGES
lib/file_size_validator.rb:5: warning: previous definition of MESSAGES was here
lib/file_size_validator.rb:6: warning: already initialized constant FileSizeValidator::CHECKS
lib/file_size_validator.rb:6: warning: previous definition of CHECKS was here
lib/file_size_validator.rb:8: warning: already initialized constant FileSizeValidator::DEFAULT_TOKENIZER
lib/file_size_validator.rb:8: warning: previous definition of DEFAULT_TOKENIZER was here
lib/file_size_validator.rb:9: warning: already initialized constant FileSizeValidator::RESERVED_OPTIONS
/lib/file_size_validator.rb:9: warning: previous definition of RESERVED_OPTIONS was here
答案 0 :(得分:2)
问题解决了 我删除字符串 要求' file_size_validator' 来自模特 因为在我的application.rb文件中
config.autoload_paths += %W(#{config.root}/lib)