[英]undefined method `escape' for URI:Module in ruby 3
將我的 Rails 應用程序從 Rails 6.0.1 更新到 Rails 7.0.2.3 后
我遇到了寶石“回形針”的問題,'~> 6.1.0'
在應用程序中使用它時會出現錯誤:
ActionView::Template::Error (undefined method `escape' for URI:Module
Did you mean? escape_once):
在我的應用程序中的用法:
<%= image_tag current_user.image.url('med'), width: "36px" %>
當 ruby gemfile 本身存在錯誤時如何解決此問題,在此先感謝。
這種情況的解決方案是對庫中缺少的方法進行猴子修補。
在初始化文件夾中添加一個 ruby filke uri_escape.rb:
為猴子修補添加行:
module URI
def URI.escape(url)
url
end
end
它完成了。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.