Minitest::UnexpectedError: TypeError: no implicit conversion from nil to integer
Closed this issue · 1 comments
przbadu commented
Describe the bug
Model code
validates_attachment :logo, content_type: { content_type: %w[image/jpg image/jpeg image/gif image/png] }
validates_attachment_size :logo, less_than: 5.megabytes, message: 'Max allowed attachment size is 5MB'
validates_attachment_presence :logo
Test case:
FactoryGirl.create(:payment_provider, logo: File.new('test/fixtures/ofx-logo.png'))
To Reproduce
Steps to reproduce the behavior:
- I am upgrading my legacy Rails app which was originally built with Rails 4.2 to Rails 5.2.8
- We migrated our paperclip to kt-paperclip during rails 5 upgrade and been running it for years without any issue. It worked well till Rails 5.1.x.
- As soon as I upgraded Rails version to 5.2.8 I am getting given error
Minitest::UnexpectedError: TypeError: no implicit conversion from nil to integer
Expected behavior
It should create uploads
Screenshots
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information):
- OS: Ubuntu 20.20
- Browser [e.g. chrome, safari]
- Version kt-paperclip-6.4.1
Smartphone (please complete the following information):
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]
przbadu commented
So the problem was because of net-protocol
gem not actually directly related with paperclip.
The fix was to downgrade net-protocol
from 0.2.2
to 0.1.1
.
gem 'net-protocol', '~> 0.1.0'
Also note that, it is happening on ruby version 3.0.x
and rails version 6.1.x
combination.