New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dorp

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dorp

  • 0.0.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Dorp

The term "Dorp" is the word in Dutch/Afrikaans that mean 'village', symbolizing the gem's capacity for managing multiple distinct 'tenants' in a single application.

Key Features:

  • Supports the essential CRUD operations for multi-tenant data isolation
  • Middleware support for subdomain or domain-based tenant scoping
  • Compatibility with Ruby on Rails 6.1+

The goal of the gem is to leverage to the maximum rails multi db feature.

Installation

To install the Dorp gem, add this line to your project's Gemfile:

gem 'dorp'

Usage

Configuration

To start, you need to cha

To migrate the the the database yaml from from a single database to multiple databases, you can use the following command:

Before:

development:
    adapter: postgresql
    database: myapp_development
    ....

After:

development:
  main:
    adapter: postgresql
    database: myapp_development
    primary: true
    ....

  hamlets:
    adapter: postgresql
    database:  myapp_tenants_development
    migrations_paths: db/tenants_migrate ## Those are the migrations that will be run for each tenant

Creating a new tenant

To create a new tenant, you can use the following command:

Dorp::Tenant.create(name: 'my_tenant', subdomain: 'my_tenant')

Creating a new model

Before starting, an abstract model must be created. This model will be used as a base for all the models that will be created for each tenant.

class TenantRecord < ApplicationRecord
  self.abstract_class = true
  include Dorp::TenantRecord
end

Then, you can create a new model that will be used for each tenant:


## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/seuros/dorp.

## License

The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

FAQs

Package last updated on 01 Feb 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc