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 9278747
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T17:27:15+00:00 2026-06-18T17:27:15+00:00

I am designing a vocabulary quiz application in ruby/rails. I have basic model/association setup

  • 0

I am designing a vocabulary quiz application in ruby/rails.
I have basic model/association setup which will work, but i am worried about scalability.
There will be a set number of words in the application. For simplicity, lets say 100.
A user will be able to proceed to a question, which will be generated from looking at which questions they have had before. The question will provide a word and 4 choices for the definition (one being the definition, three other definitions being randomly chosen).

Here is the way my models and associations are set up currently;

class User < ActiveRecord::Base
  has_many :user_questions
end

class UserQuestion < ActiveRecord::Base
  belongs_to :user
  belongs_to :vocab_word
end

class VocabWord < ActiveRecord::base
  has_many :user_question
end

Assuming i were to keep this basic model, which of the following approaches should i use?

  1. Have a set number of UserQuestion objects (100) per user and use
    calculated columns to store statistics the users performance on
    particular words. (e.g. user 502 has attempted the word ‘arid’ 3
    times and correctlty answered 2 times).
  2. For each question
    attempt, create a new UserQuestion object. (e.g. user 502 attempted
    to guess ‘arid’ and was incorrect)

Are either of these approaches scalable? If the application had one million users, the first strategy would have 100 million rows in user_questions. the second could have much more than that.

  • 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-18T17:27:17+00:00Added an answer on June 18, 2026 at 5:27 pm

    You’re almost there. I would recommend extending your model with the following, plus the slight correction on UserQuestion and User association.

    class User < ActiveRecord::Base
      has_and_belongs_to_many :user_questions
    end
    
    class UserQuestion < ActiveRecord::Base
      has_and_belongs_to_many :users
      belongs_to :vocab_word
    end
    
    class VocabWord < ActiveRecord::base
      has_many :user_question
    end
    
    class Attempt < ActiveRecord::base
      belongs_to :vocab_word
      belongs_to :user
      belongs_to :user_question
    
      attr_accessible :result
    end
    

    You’d need a user_questions_users association table to have a many-to-many association between questions and users. I believe it would be scalable. Make sure you set your indexes correctly.

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

Sidebar

Related Questions

Designing AIR application which has to have server side push or notification, don't know
Designing an Azure application where remote clients will be 'streaming' data/images at a frequency
When designing my application how many controllers should I have? Is it good practice
I designing a Java desktop app which will open web page, allow user to
While designing a table which have impact based on date (e.g. Currency Rate) which
Designing forms has always been fun, but getting them to send email on the
When designing a C API for configuring a library/utility, I have a co-worker who
While designing a new WPF application I noticed exceptions not being thrown during data
When designing a form I have the option of putting a close button at
When designing an distributed application in Java there seem to be a few technologies

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.