[英]Using Ros Apartment gem with ruby 3.0.0
After updating ruby version from 2.7.4 => 3.0.0 seems that ros-apartment gem cannot switch between tenants.从 2.7.4 => 3.0.0 更新 ruby 版本后,ros-apartment gem 似乎无法在租户之间切换。
NoMethodError (undefined method `decode' for URI:Module):
lib/rescued_tenant_elevator.rb:10:in `block in call'
lib/rescued_tenant_elevator.rb:10:in `call'
After searching in documentation of ros-apartment seems that the problem is on generic call after calling @app.call(env)在 ros-apartment 的文档中搜索后,似乎问题出在调用 @app.call(env) 后的通用调用上
My class for switching tenants我的切换租户的课程
require 'apartment/elevators/subdomain'
class RescuedTenantElevator < ::Apartment::Elevators::Subdomain
def call(env)
super
rescue Apartment::TenantNotFound
[302, { 'Content-Type' => 'text/hml', 'Location' => Rails.application.routes.url_helpers.root_url }, self]
end
# needed to work
def each
end
end
Any idea ??任何想法 ??
Until apartment gem release any change about that i fixed it re-adding the URI methods in init直到公寓 gem 发布任何关于我修复它的更改,在 init 中重新添加 URI 方法
module URI
def URI.decode(url)
url
end
def URI.escape(url)
url
end
end
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.