Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7811223
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T04:04:49+00:00 2026-06-02T04:04:49+00:00

I am using Ruby on Rails and devise for authentication. I have a user(customer)

  • 0

I am using Ruby on Rails and devise for authentication. I have a user(customer) model and a business model. I want users(customers) to sign up through a particular business and belong to a particular business. A business has many users(customers), but a user only belongs to one business. I ended up wanting to have businesses be able to use a sub domain of their own domain to correspond to their own id, but now that I’m getting to that point I have no idea how to approach that..

Honestly I’m still in high school and I don’t have a good idea of how everything comes together with something like this. So I’m planning on licensing this app to businesses (already have a few that have paid up front before I’ve developed this thing). Each business’s data needs to be separate from the other businesses. Some businesses don’t have a domain at all so I will have to use a sub domain on my server. And some businesses do have a website so I want to use a sub domain through their business’s domain.

I’m now thinking it is definitely better to use multiple databases.. Honestly I have very limited knowledge of database structures. I believe it’s possible to run separate individual apps which I’ve been thinking may be the best way to roll this. Also maybe the easiest to develop/maintain?

So my questions are what are the tradeoffs of running multiple databases vs running separate individual apps? And where would I found out more information on how to actually do this? Also could anyone lead me into the right direction on how to forward these domain or w/e I have to do?

Also please comment if my question wasn’t clear enough… and sorry it’s so long lol.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T04:04:52+00:00Added an answer on June 2, 2026 at 4:04 am

    Once you go down the road of multiple databases, you can’t easily go back, so you better have a very good reason for doing it. Unless you have serious scaling problems, it’s probably best to delay that decision as long as possible, and instead work on partitioning your database using standard relationships.

    Rails makes it easy to do this since you can apply a scope to pretty much anything. For instance, you create a Business model, and then instead of fetching other objects directly, you always do it in a particular context. In practice this looks like:

    @orders = @business.orders.paginated
    

    You can make all of your “business-oriented” controllers descendants of a parent class that will load in the correct @business model using a before_filter so that this doesn’t have to be replicated in many different controllers.

    If at any point you do want to split the databases, you can do that by separating the tables based on business_id or other derived relationships.

    I’ve found this works quite well for most applications and can scale reasonably well. Remember that the first step of scaling isn’t sharing but replication, as having a number of read-only replicas can massively improve read performance without complicating your application internally.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an app that is using devise for authentication. Rails 3 on ruby
I am using Devise with Ruby on Rails. I have a few pages that
I want to add multiple emails to the user model while using devise, using
I am using Ruby on Rails. I want to create a filter field on
I am using ruby on rails with a MySQL backend. I have a table
I am using Ruby on Rails 3.2.2, cucumber-rails-1.3.0, rspec-rails-2.8.1, capybara-1.1.2 and factory_girl-2.6.3. I have
I need to know how configure the gem devise,Im using ruby 1.9.2, rails 3.1.3,
Using Ruby on Rails 3, I have a page with a list of comments
I'm working on a Ruby on Rails application that used the Devise authentication system.
I'm using Rails 3.0.9, Ruby 1.9.2, Devise 1.3.4 and has a need in Devise

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.