After updating my Rails application from Rails 6.0.1 to Rails 7.0.2.3
I am getting issue with the gem "paperclip", '~> 6.1.0'
while using it in application is gives error:
ActionView::Template::Error (undefined method `escape' for URI:Module
Did you mean? escape_once):
Usage in my application:
<%= image_tag current_user.image.url('med'), width: "36px" %>
How to resolve this issue when bug is present in the ruby gemfile itself, thanks in advance.
The solution to this situation do a monkey patching to the missing method in library.
add a ruby filke uri_escape.rb inside the initializers folder:
add lines for monkey patching:
module URI
def URI.escape(url)
url
end
end
and its done.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.