jekuno / milia

Easy multi-tenanting for Rails5 (or Rails4) + Devise
MIT License
341 stars 72 forks source link

Milia gem doesn't uploaded #89

Open kashtech79 opened 4 years ago

kashtech79 commented 4 years ago

Please help me if you can, this is my last attempt on Rails, like all other former Rails programmer I'll have no choice to leave Rails.

I use Rails 6

my gemfile

gem 'pg', '>= 0.18', '< 2.0' gem 'devise' gem 'milia'

ApplicationController.rb

class ApplicationController < ActionController::Base before_action :authenticate_tenant! end

Error generate

/home/kash/.rvm/gems/ruby-2.7.0/gems/activerecord-6.0.2.2/lib/active_record/type.rb:27: warning: Using the last argument as keyword parameters is deprecated; maybe ** should be added to the call /home/kash/.rvm/gems/ruby-2.7.0/gems/activerecord- 6.0.2.2/lib/active_record/type/adapter_specific_registry.rb:9: warning: The called method add_modifier' is defined here /home/kash/.rvm/gems/ruby-2.7.0/gems/milia- 0.3.30/app/controllers/registrations_controller.rb:5:in': undefined method skip_before_filter' for Milia::RegistrationsController:Class Did you mean? skip_before_action (NoMethodError) from /home/kash/.rvm/gems/ruby-2.7.0/gems/milia- 0.3.30/app/controllers/registrations_controller.rb:3:in' from /home/kash/.rvm/gems/ruby-2.7.0/gems/milia-

yshmarov commented 4 years ago

This works: Gemfile: gem 'milia', '~>1.3', :git => 'https://github.com/yshmarov/milia.git'

gem milia POST MORTEM

So, the gem has not been maintained by the "owner" for 3 years now. Pull requests are even reviewed.

Face it, Milia was never a good multi-tenanting gem. On the top of my head - too much magic in the installation, and anyways sessions is not the best way to track current_tenant. It can get "stuck" when logging in/out and switching tenants.

Unfortunately I fell for it some years ago and wasted dozens of hours as a consequence. I should have gone with something else.

Why milia? 95% of the popularity of this gem came from this amateur-level course on udemy

what now?

  1. A few users have forked the gem and customized it for their personal needs. You can check out the forks and find something interesting

  2. We don't need 5 gems that do the same thing. Better to put all effort into one gem that does the job well (think devise).

In case of multitenancy, we have 2 good options: https://github.com/ErwinM/acts_as_tenant - all tenants in one database https://github.com/influitive/apartment - separate database for each tenant

summary: don't rely on low-maintained third-party code, like gem milia

Not to underestimate the initial creator of the gem @dsaronin who was a legend.

Originally posted by @yshmarov in https://github.com/jekuno/milia/issues/88#issuecomment-629719532

jekuno commented 4 years ago

@yshmarov Thanks for bringing the mainitenance topic back to my attention. Please see https://github.com/jekuno/milia/issues/90 for more details.