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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T21:01:21+00:00 2026-05-17T21:01:21+00:00

Just looking for some advice on how to structure my relationships in an app

  • 0

Just looking for some advice on how to structure my relationships in an app that I’m making. I have the following models:

activity # golf, karaoke
event    # golf competition followed by all-night karaoke boat party
post     # write-up of the golf and karaoke event mentioned above
gallery  # photos from the golf and karaoke event

Question 1

  • each event can involve more than one activity
  • each activity can be associated with more than one event

Do I need a habtm between activity and event?


Question 2

  • each event can be reported in more than one blog post
  • a post can report on more than one event

Should I use a habtm between event and post?


Question 3

  • each post can include images from more than one gallery
  • a gallery can be included in more than one post

Is this another habtm?


Question 4 – It’s conceivable that the admins might want to link 1 or more sets of photos with 1 or more events, without creating a blog post to tie everything together. Would it be advisable to declare a habtm relationship between galleries and events?


For bonus points: Is an app with this many habtm’s likely to be slower than one which enforces one-to-many relationships between the same models? Is there a suggested limit to the number of habtm relationships an app an have before it becomes too complex?

Thanks in advance

  • 1 1 Answer
  • 2 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-17T21:01:22+00:00Added an answer on May 17, 2026 at 9:01 pm

    All cases needs habtm. It follows from your specyfication. You can only wonder if you really need such relations. Look at http://en.wikipedia.org/wiki/You_ain%27t_gonna_need_it “YAGNI”.
    I would not also think about speed during developement. When your app will be slow, add caching.

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

Sidebar

Related Questions

Just looking for some advice regarding a structure that I am using in some
Just looking for some advice here on a small job I have to do.
I'm just looking for some advice. I'm creating a website that offers (at least)
I'm looking for some advice on best practice when writing a web app that
We're looking for some advice on our StarTeam configuration. We have a project that
Just looking for some advice.. I have two websites on IIS7 which are seperate
just looking for some advice, pointers, and suggestions for further reading. I have: 1
Really quick here... I think I have the answer, but just looking for some
Does anyone have some numbers on this? I am just looking for a percentage,
Just looking for some advice on the best to approach a profile picture system

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.