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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T09:40:51+00:00 2026-05-26T09:40:51+00:00

I have a Invite model, which has n + m attributes (location, timing etc.).

  • 0

I have a Invite model, which has n + m attributes (location, timing etc.). When an invite is accepted, an Event object is created with n attributes copied from Invite model and k attributes of its own. I want to avoid duplication of n attributes.

How should I model this relationship in Rails?

Thank you.

  • 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-26T09:40:51+00:00Added an answer on May 26, 2026 at 9:40 am

    Don’t think about the attributes, think about the objects and what they model (represent) in the real world. Also think about the life-cycle of the objects

    • Invites are something easily understandable
    • Events are also understandable

    Just because there is an overlap doesn’t mean that you want to eliminate it.

    If you really want, you could say that every Event belongs_to an Invite. (And the n attributes are stored only in the owning Invite model.)

    But before you do this, ensure with business logic that Invites are never changed once they reach the accepted state.

    Added Another reason to duplicate the n attributes: Suppose those attributes are later changed for the actual event–you’d want the attributes to be in the Event model. If you had one set of data for the Invite and the Event, then you’d be saying that those attributes are fixed from the time the Invite was entered.

    But that may well not match with the real world. And if you do change the values, then you’d lose the information of what the values originally were when the invite was entered.

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

Sidebar

Related Questions

We have created an invite function at our site in JavaScript using the Graph
I have recently being trying to create a project which has several levels of
I have some code written like so: class Invite(models.Model): STATE_UNKNOWN = 0 STATE_WILL_PLAY =
I have field in my Model which indicates whether a user wants to receive
I have made a control that creates an electronic invite to an event. The
I have a FaceBook app in which I use the apprequests API to invite
Have just started using Visual Studio Professional's built-in unit testing features, which as I
Have you refactored from an ActiveRecord to a DataMapper pattern? What conditions prompted the
I have three entities: User , Team , and TeamInvite . Each User has
i have a model using m2m feature: class Classroom(models.Model): user = models.ForeignKey(User, related_name =

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.