mardi 10 mai 2022

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.

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)

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 ??

Aucun commentaire:

Enregistrer un commentaire