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

  • SEARCH
  • Home
  • 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 8296603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T15:05:14+00:00 2026-06-08T15:05:14+00:00

I have a Rails website with three tables: User, Task, and TaskInstance. The Task

  • 0

I have a Rails website with three tables: User, Task, and TaskInstance. The Task table is like a master list of tasks, not coupled to any particular user, whereas the TaskInstance table contains records that indicate a user’s completion of a particular task. In other words, a TaskInstance has a User id, a Task id, and a completion status (boolean). A User has many TaskInstances.

I’d like to allow administrators to add new Tasks. Doing so should create a new TaskInstance for that Task for every User. However, that doesn’t sound like it would scale well. Say I have fifty thousand Users, creation of a new Task would require fifty thousand TaskInstances to be created immediately on the spot.

It would be good if some sort of lazy loading could be done instead, but I don’t know where I would do it. I could do it at login e.g. when a User logs in, check if a new Task has been created; if so, create a new TaskInstance only for that particular User. But then what about users that are already logged in when the new Task is created?

I guess I’m just wondering what the preferred approach to this sort of problem is.

Move this to the community wiki if you need to.

  • 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-08T15:05:16+00:00Added an answer on June 8, 2026 at 3:05 pm

    Don’t create the TaskInstances right upfront, but only when they are needed. Since a new Task gets created anyway, it can be displayed to any User, no matter if there is a TaskInstance or not. As soon as a user decides to start with a Task, the TaskInstance should get instantiated.

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

Sidebar

Related Questions

I have a Java servlet website, but does not use any frameworks like Spring
I have a production Rails 2.3.5 website, and I'd like to the change the
I have a live rails website and I want to have a form with
Suppose I want to have a blog with Rails 3 on my website and
I'm building a website with Rails which can let user check if some domains
I am planning to have something like this for a website that is on
I'm using rails to build a website. I have a yaml file contails some
I have a website that degrades gracefully for users without javascript. For a user
I have a Rails 3 website, for which the home page is static content
I have a Rails app with some basic models. The website displays data retrieved

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.