-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmodels.rb
103 lines (78 loc) · 2.43 KB
/
models.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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
class Category
include DataMapper::Resource
property :id, Serial
property :name, String, :required => true
has n, :points
end
class Condition
include DataMapper::Resource
property :id, Serial
property :desc, Text, :required => true
has n, :points
end
class Photo
include DataMapper::Resource
include Paperclip::Resource
property :id, Serial
has_attached_file :pic,
:styles => { :medium => "400x300",
:large => "400x300" },
:storage => :s3,
:s3_credentials => {:access_key_id => "AKIAIJUGMKYECWUFG2VQ",
:secret_access_key => "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"},
:bucket => "mtm_test_data",
:path => "images/test/:basename.:extension"
belongs_to :point
end
class Problem
include DataMapper::Resource
include Paperclip::Resource
property :id, Serial
property :lat, Float
property :long, Float
property :desc, String
property :title, String
property :user, String
has_attached_file :pic,
:styles => { :medium => "400x300",
:large => "400x300" },
:storage => :s3,
:s3_credentials => {:access_key_id => "AKIAIJUGMKYECWUFG2VQ",
:secret_access_key => "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"},
:bucket => "mtm_test_data",
:path => "images/test/:basename.:extension"
end
class Trail
include DataMapper::Resource
property :id, Serial
property :name, String, :required => true
has n, :points
end
class Point
include DataMapper::Resource
include Paperclip::Resource
property :id, Serial
property :lat, Float, :required => true
property :long, Float, :required => true
property :desc, Text
property :title, String
belongs_to :category
belongs_to :condition
belongs_to :trail
has n, :photos
has n, :connections
end
class Connection
include DataMapper::Resource
property :id, Serial
property :connected_to, Integer, :required => true
property :connected_from, Integer, :required => true
belongs_to :point
end
class User
include DataMapper::Resource
property :id, Serial
property :email, String, :required => true
property :pwhash, String, :required => true
property :admin, Boolean, :default => false
end