forked from ngehani/omrails
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTo Do List.rb
57 lines (45 loc) · 1.34 KB
/
To Do List.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
To Do List
Neil's Models and relationships:
USER
has_many :created_invitations (:event)
has_many :hosted_invitations (:event)
has_many :guest_invitations (:event)
has_many :rsvps
has_many :attended_events (:event_attendance)
fields >> [:first_name, :last_name, :email, :password_stuff]
EVENT
belongs_to :creator (:user)
has_many :hosts (:user)
has_many :invited_guests (:user)
has_many :rsvps
belongs_to :location
fields >> [:start_date, :end_date, :start_time, :end_time, :location_id ]
RSVP
belongs_to :user
belongs_to :event
:yes/no/maybe
LOCATION
has_many :events
fields >> [:city, :state, :zip, :address, :lat, :lng]
EVENT_ATTENDANCE 1. who needs to be related to this? 2. How many of each thing can each side have?
belongs_to :user
belong_to :event
:id :user_id :event_id
1 1 1
2 1 3
3 1 4
...
-----------------------
Join tables
INVITATIONHOSTING << "join table"
belongs_to :host (:user)
belongs_to :hosted_invitation (:invitation)
invitation_id user_id
1 1
1 2
1 5
2 1
2 5
GUESTINVITING
belongs_to :invited_guest (:user)
belongs_to :invitation