Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

warning: URI.escape is obsolete when using paperclip in ruby 2.7.2

   ruby - 2.7.2
   rails - 6.0
   paperclip - 6.1.0

I am getting following warning in my console, while using paperclip gem with ruby 2.7.2

   /Users/***/.rvm/gems/ruby-2.7.2/gems/paperclip-6.1.0/lib/paperclip/url_generator.rb:68: warning: URI.escape is obsolete

I know there are no maintainers for paperclip and it is deprecated but I cannot use active storage as I found paperclip is the easiest and best way for implementing attachments. How can I solve this warning ?

like image 699
honey Avatar asked Apr 17 '21 03:04

honey


1 Answers

When you say "solve" the warning it's not quite clear what you might consider to be an acceptable solution. But you could:

  • a) Ignore the warning so long as you are sticking with these versions of Ruby and Rails, as it does not mean that anything is broken.
  • b) Write some code to suppress this specific warning, though I'd probably not do this as you'd increase the chance of forgetting about the issue, and then ending up with a more acute and time-sensitive problem down the road, if you upgraded part of your system to where URI.escape was no longer available.
  • c) Do what I've done in my Rails application, which is switch to a forked and maintained version of Paperclip, KT-Paperclip. If you wanted to update to the minimum version number that addresses these deprecation warnings, you'd choose 6.4.
like image 159
UptDogTT Avatar answered Nov 09 '22 04:11

UptDogTT