influitive / apartment

Database multi-tenancy for Rack (and Rails) applications
2.66k stars 464 forks source link

Independent users instead of Global users #584

Closed conal4284 closed 5 years ago

conal4284 commented 5 years ago

Steps to reproduce

In apartment.rb config.excluded_models = %w{ User } is used to make Users global. i.e. Users will work for any tenant. I am trying to make users independent by removing it from above given statement in apartment.rb. It is not working. How this can be achieved?

System configuration

derosm2 commented 5 years ago

I've had success excluding models, but am on Rails 5.2 and Ruby 2.5.

config.excluded_models = ["Delayed::Backend::ActiveRecord::Job"]
conal4284 commented 5 years ago

I want to include model for every tenant. In other words I want tenant specific users. The users of tenant A cannot login into tenant B.

derosm2 commented 5 years ago

Ah, that should work by default if you remove the entire line

config.excluded_models = %w{ User }

excluded_models defaults to an empty array, so nothing should be excluded.

mikecmpbll commented 5 years ago

yeah, if you don't want to the exclude the model don't include it in the excluded_models. need some more details about what doesn't work if you're still struggling.