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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T09:56:35+00:00 2026-05-18T09:56:35+00:00

This is homework, just so that’s mentioned. I have project called AdventCalendar, which is

  • 0

This is homework, just so that’s mentioned.

I have project called AdventCalendar, which is supposed to be an Advent Calendar, (obviously).
I have made it possible to log in/ log out, or create new users. Once you have logged in you may create Calendars (Advent calendars). Each calendar has many days, and a day belongs to one calendar. Also, a user can create many calendars.

So, what I want is to make it possible for a user to share their calendars with other users if they want to. I’m kind of stuck and don’t know where to go from here. I thought maybe to add a

has_and_belongs_to_many :users

to calendar, and likewise:

has_and_belongs_to_many :calendars

to users..

I just don’t know how to implement it.
Any tips, or help is highly appreciated!

Thanks in advance.

  • 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-18T09:56:36+00:00Added an answer on May 18, 2026 at 9:56 am

    Yes you’re right on point here. Though I think its a little less complicated. Calendars do not have to have many users. The relationship, hierarchically is ok with just users having calendars. Then, for calendars, create a polymorphic join table to allow a calendar to have many users associated with.

    #user.rb
    
     has_many    :calendars
    
    
    #calendar.rb
    
     belongs_to  :many_users, :polymorphic => true
     has_many    :users, :as => :many_users
    

    Your calendar table should have a many_users_id, and a user_id field.

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

Sidebar

Related Questions

this one is not homework, it just the fact that i've been out of
this is a homework which I already did, I just need either confirmation if
I have a question about my C++ homework. I am just confused about *this.
This isn't actually a homework question per se, just a question that keeps nagging
I have this homework that I gotta finish, but then something about it is
This is a homework assignment, just for all that want to know. I'm writing
This is homework...I'm not asking for answers, I just have a bug I'm not
I have a few questions. Yes this is homework and I am just trying
Firstly, this is going to sound like homework, but it ain't. Just a problem
I'm trying to solve this problem, its not a homework question, its just code

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.