forked from mashbash/whats_the_plan
/
Database
50 lines (45 loc) · 745 Bytes
/
Database
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
Database
Validations - done by the pair that makes the models
1. User
Using DEVISE - creates password digest, email
Attributes
name
email
password
location details - street name, country, etc. (optional)
Association
has_many :plans
2. Plan
Attributes
title
user_id
location (pulled from activities/meals)
start_date
end_date
store activities for the day
Associations
belongs_to :user
has_many :activities, through :activity_plans
has_many :activity_plans
3. Activity
Attributes
title
street
city
state
zipcode
country
latitude
longitude
meal
Associations
has_many :activity_plans
has_many :plans, through :activity_plans
4. Activity_plans
Attributes
plan_id
activity_id
sequence( 1..4 )
Associations
belongs_to :activity
belongs_to :plan