'Setting up comfy cms fails with multi-tenancy app

I've got an app for which I'd like to use the comfy cms. I did the following:

  1. added gem "comfortable_mexican_sofa", "~> 2.0.0"
  2. bundle install
  3. rails g comfy:cms

When I try to migrate I get the following error:

ArgumentError: wrong number of arguments (given 1, expected 0)
/Users/.../.rvm/gems/ruby-3.0.2/gems/comfortable_mexican_sofa-2.0.19/lib/comfortable_mexican_sofa/routes/cms_admin.rb:5:in `comfy_route_cms_admin'

Here is my routes.rb

class SubdomainConstraint
  def self.matches?(request)
    request.subdomain.present? && !Apartment::Elevators::Subdomain.excluded_subdomains.include?(request.subdomain)
  end
end


Rails.application.routes.draw do


  constraints SubdomainConstraint do
    root "static_pages#welcome", as: 'team_root'
    
    resources :groups
    resources :bookings
    resources :time_tables
    resources :access_codes
    resources :business_hours

    devise_for :users, controllers: {invitations: "users/invitations",  registrations: 'users/registrations', sessions: 'users/sessions', confirmations: 'users/confirmations', omniauth_callbacks: 'users/omniauth_callbacks'}

  end


  ...

  root "static_pages#index"
  comfy_route :cms_admin, path: "/admin"
  
  # Ensure that this route is defined last
  comfy_route :cms, path: "/"
end

When I uncomment comfy_route :cms_admin, path: "/admin", I can migrate and start the server. So I think there is something wrong with my routes, but I don't know what. I also use the apartment gem for multi tenancy.



Solution 1:[1]

The latest (2.0.19) version of Comfortable Mexican Sofa doesn't work properly with ruby 3, someone has already created a pull request with a bug fix, but it's not merged. The best way out now is to install the gem from the fork of the author of this pull request. In your Gemfile:

gem 'comfortable_mexican_sofa', git: 'https://github.com/restarone/comfortable-mexican-sofa'

Or you can fork this repo and install the gem from your account if you don't want someone to change the gem code.

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Daniil Orlov