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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T05:00:50+00:00 2026-05-14T05:00:50+00:00

A rails app I’m working on features examples of quadratic equations. Obviously, these are

  • 0

A rails app I’m working on features examples of quadratic equations. Obviously, these are all of a common structure: ax^2 + bx + c = 0.

I don’t want to store every single example of these. I’d rather generate them from a template. Storing hundreds of possible versions of this structure seems highly wasteful and un-DRY.

On the other hand, if I generate them, I can’t access them again reliably as I could if they were simply multiple database objects.

I’m sure there must be a way to overcome this, but I’m still learning rails and I’m obviously not grasping something here. Thanks.

  • 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-05-14T05:00:50+00:00Added an answer on May 14, 2026 at 5:00 am

    The answer is “it depends”. If you’re only ever going to do examples of quadratic equations, then you can just store a, b and c. If you think you’re going to do other types of equations, store the whole thing.

    What really shouldn’t be a consideration is that its a “waste” to store the full equation in the sense that you’re wasting disk space. Unless you’re storing millions of these things, don’t worry about it. Disk is cheap.

    Other viewpoints to take are YAGNI (Ya Ain’t Gonna Need It) which would say to code with the situation you have now, quadratic equations, and don’t worry about generalizing it. If you need to you can refactor the code and the data later.

    Another way to look at it is KISS (Keep It Simple, Stupid). The simplest thing to do would likely to be to just store the complete equation. This makes retrieving the equation a simple database fetch, no code to generate the equation is necessary.

    Personally, assuming you’re not doing a huge amount of these things, I’d favor KISS in this situation. I wouldn’t be confident that the system is only going to be used for quadratic equations. What you can do is make the system handle whatever equations but make the input form take a, b and c and turn that into a quadratic equation. If you need other equation types later, changing the input logic is much simpler than changing the data structure.

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

Sidebar

Related Questions

My rails app uploads all users photos to a folder /uploads/photos/. I want to
I have a rails app with locomotive cms. I want to be able to
I have a working rails app that uses imagemagick commands on my local mac
My Rails app is using version 3.2.3 and I want to deploy to Heroku
My rails app has a simple model Links which tracks all the Urls associated
Needs to create a Rails App where I want to get the time in
A Rails app I'm working on will receive emails with attachments and then process
My rails app is working just fine when it is in development mode however
I have a Rails app that I want to upload to AppFog. Installed the
My rails app is set up using a mysql database. When I do a

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.