百科.dev
全部条目在线工具AI 编程趋势榜开源项目技术资讯提交条目
登录
< 返回工具列表
A

activerecord-tenanted

> 编程语言
开源

使 Rails 应用程序为每个租户拥有独立的数据库。

609 stars0 点赞3 次浏览
访问官网GitHub

工具介绍

使 Rails 应用程序为每个租户拥有独立的数据库。

ActiveRecord::Tenanted

Enable a Rails application to host multiple isolated tenants.

[!NOTE] Only the sqlite3 database adapter is fully supported right now. If you have a use case for tenanting one of the other databases supported by Rails, please reach out to the maintainers!

Summary

What is "multi-tenancy"?

A "multi-tenant application" can be informally defined as:

... a single instance of a software application (and its underlying database and hardware) serv[ing] multiple tenants (or user accounts).

A tenant can be an individual user, but more frequently, it’s a group of users — such as a customer organization — that shares common access to and privileges within the application instance. Each tenant’s data is isolated from, and invisible to, the other tenants sharing the application instance, ensuring data security and privacy for all tenants.

-- IBM.com, "What is multi-tenant?"

This gem's design is rooted in a few guiding principles in order to safely allow multiple tenants to share a Rails application instance:

  • Data "at rest" is persisted in a separate store for each tenant's data, isolated either physically or logically from other tenants.
  • Data "in transit" is only sent to users with authenticated access to the tenant instance.
  • All tenant-related code execution must happen within a well-defined isolated tenant context with controls around data access and transmission.

Making it dead simple.

Another guiding principle, though, is:

  • Developing a multi-tenant Rails app should be as easy as developing a single-tenant app.

Your code shouldn't have to know about tenanting! The hope is that you will rarely need to think about managing tenant isolation, and that as long as you're following Rails conventions, this gem and the framework will keep your tenants' data safe.

This gem extends or integrates tightly with Rails to ensure that any data persisted or transmitted happens within an isolated tenant context — without developers having to think about it.

Installation

Install the gem and add to the application's Gemfile by executing:

bash
bundle add activerecord-tenanted

Usage

For detailed configuration and usage, see GUIDE.md.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/basecamp/activerecord-tenanted. The tests are split between:

  • fast unit tests run by bin/test-unit
  • slower integration tests run by bin/test-integration

For a full test feedback loop, run bin/ci.

License

The gem is available as open source under the terms of the MIT License.

Issues· 0 开放

查看全部 Issues在 GitHub 打开

暂无开放 Issues,或尚未同步最近议题。

> 标签

Ruby

暂无评论,来聊聊你的看法吧

> 工具信息

发布日期2026年8月1日
最后更新2026年9月17日
分类编程语言
定价开源

> 相关工具

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言