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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T18:44:26+00:00 2026-05-14T18:44:26+00:00

I think the way I’ve modelled my app is a bit fishy and i

  • 0

I think the way I’ve modelled my app is a bit fishy and i need to rejig things, im just not sure how. I’ve already re-jigged and refactored before. It took a long time ( I’m a beginner ) and I’m hesitant to it again in case i head off in the wrong direction again.

Basic Idea, user can submit an answer, another user can mark it correct or incorrect. If incorrect they have to write the correct answer. Users can view their and everybody else’s correct and incorrect answers.

So I did it this way

class Answer
  has_one: correction
end

class Correction
  belongs_to :answer
end

when a user marks an answer as correct, I set checked_at:DateTime and checked_by_id:integer on the Answer object to keep track of who checked the answer and when.

For incorrect answers I create a correction object which holds the correct answer and again checked_by and checked_at details.

I don’t like this because I have checked_by and checked_at in both models. It just doesn’t sit right.

Possible solutions are:

Create a third model such as VerifiedAnswer and move the checked_by/at attributes to that. It will handle the situtation where an answer is marked correct.

Or are these models thin enough (they dont have any other attributes) that I can just have one model ( Answer ) that has all the attributes to store all this information?

  • 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-14T18:44:27+00:00Added an answer on May 14, 2026 at 6:44 pm

    I would make an answer corrected by another answer.
    That way, you can keep correcting the new answer.

    This could be done by specifying:

    class Answer
      belongs_to :correction, :class_name => "Answer"
    end
    

    Note that this will mean that any existing answers with corrections will have data set up incorrectly (since the correction_id is currently pointing to a separate table).
    You would need to clear out your database for this to work.

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

Sidebar

Related Questions

Friends, I have a strange need and cannot think my way through the problem.
So I am trying to think of a way to facilitate two things. It
The best way I think to explain this is to tell you what my
I think the best way to express my question is by showing an example:
I think the easiest way to explain is simply linking to an example of
I couldn't think of a way to word the title, so sorry for that,
I'm trying to think of a way to create a plugin architecture for my
I've been trying to think of a way to traverse a hierarchical structure, like
I found a way to write the if statement in another way (I think)
I'm trying to wrap my head around this and I think the easiest way

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.