narrow-electrician-89982
04/14/2025, 6:41 AMlemon-wall-20836
04/14/2025, 9:54 AMlemon-wall-20836
04/14/2025, 9:55 AMlemon-wall-20836
04/14/2025, 9:55 AMlemon-wall-20836
04/14/2025, 9:57 AMlemon-wall-20836
04/14/2025, 9:58 AMflat-country-54330
04/14/2025, 10:51 AMnarrow-electrician-89982
04/14/2025, 5:02 PMnarrow-electrician-89982
04/14/2025, 5:02 PMnarrow-electrician-89982
04/14/2025, 5:03 PMflat-country-54330
04/14/2025, 5:40 PMruby
# Event
field :name, type: String
field :starting_date, type: DateTime
field :ending_date, type: DateTime
field :start_time, type: DateTime
field :end_time, type: DateTime
field :duration, type: Integer # in sec
field :days_of_week, type: Array
belongs_to :creator, class_name: 'User'
has_many :event_invites, dependent: :destroy
has_many :invited_users, through: :event_invites, source: :user
# user
#other fields
has_many :created_events, class_name: 'Event', foreign_key: 'creator_id', dependent: :destroy
has_many :event_invites, dependent: :destroy
has_many :invited_events, through: :event_invites, source: :event
# EventInvite
belongs_to :user
belongs_to :event
This way we don't have to create multiple events. with 1 event we can manage most of things.
For me: I updated the same event for new invite or removing any existing user from the event. but there can be some scenarios to duplicate the event with little tweaks with range, day of week.lemon-wall-20836
04/15/2025, 5:39 AMnarrow-electrician-89982
04/15/2025, 7:17 AM