simply_stored 0.5.4 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +9 -0
- data/Gemfile.lock +13 -5
- data/README.md +41 -0
- data/lib/simply_stored/couch/belongs_to.rb +6 -8
- data/lib/simply_stored/couch/ext/couch_potato.rb +26 -0
- data/lib/simply_stored/couch/has_many.rb +1 -1
- data/lib/simply_stored/couch.rb +2 -30
- data/lib/simply_stored/instance_methods.rb +14 -8
- data/lib/simply_stored.rb +12 -10
- metadata +175 -56
- data/test/active_model_compatibility_test.rb +0 -23
- data/test/belongs_to_test.rb +0 -173
- data/test/conflict_handling_test.rb +0 -96
- data/test/finder_test.rb +0 -188
- data/test/fixtures/couch.rb +0 -286
- data/test/has_and_belongs_to_many_test.rb +0 -639
- data/test/has_many_test.rb +0 -489
- data/test/has_one_test.rb +0 -154
- data/test/instance_lifecycle_test.rb +0 -249
- data/test/mass_assignment_protection_test.rb +0 -77
- data/test/s3_test.rb +0 -256
- data/test/soft_deletable_test.rb +0 -468
- data/test/test_helper.rb +0 -19
- data/test/validations_test.rb +0 -142
- data/test/views_test.rb +0 -33
data/test/fixtures/couch.rb
DELETED
@@ -1,286 +0,0 @@
|
|
1
|
-
class User
|
2
|
-
include SimplyStored::Couch
|
3
|
-
validates_presence_of :title
|
4
|
-
|
5
|
-
property :name
|
6
|
-
property :title
|
7
|
-
property :homepage
|
8
|
-
|
9
|
-
has_many :posts
|
10
|
-
has_many :strict_posts
|
11
|
-
has_many :hemorrhoids
|
12
|
-
has_many :pains, :through => :hemorrhoids
|
13
|
-
has_many :docs, :class_name => "Document", :foreign_key => "editor_id"
|
14
|
-
|
15
|
-
view :by_name_and_created_at, :key => [:name, :created_at]
|
16
|
-
end
|
17
|
-
|
18
|
-
class Post
|
19
|
-
include SimplyStored::Couch
|
20
|
-
|
21
|
-
belongs_to :user
|
22
|
-
end
|
23
|
-
|
24
|
-
class StrictPost
|
25
|
-
include SimplyStored::Couch
|
26
|
-
|
27
|
-
belongs_to :user
|
28
|
-
|
29
|
-
validates_presence_of :user
|
30
|
-
end
|
31
|
-
|
32
|
-
class Comment
|
33
|
-
include SimplyStored::Couch
|
34
|
-
|
35
|
-
belongs_to :user
|
36
|
-
belongs_to :network
|
37
|
-
end
|
38
|
-
|
39
|
-
class Category
|
40
|
-
include SimplyStored::Couch
|
41
|
-
|
42
|
-
property :name
|
43
|
-
property :alias
|
44
|
-
property :parent
|
45
|
-
|
46
|
-
validates_inclusion_of :name, :in => ["food", "drinks", "party"], :allow_blank => true
|
47
|
-
end
|
48
|
-
|
49
|
-
class Document
|
50
|
-
include SimplyStored::Couch
|
51
|
-
|
52
|
-
belongs_to :author, :class_name => "User"
|
53
|
-
belongs_to :editor, :class_name => "User"
|
54
|
-
end
|
55
|
-
|
56
|
-
class Tag
|
57
|
-
include SimplyStored::Couch
|
58
|
-
|
59
|
-
belongs_to :category
|
60
|
-
property :name
|
61
|
-
end
|
62
|
-
|
63
|
-
class Instance
|
64
|
-
include SimplyStored::Couch
|
65
|
-
has_one :identity
|
66
|
-
end
|
67
|
-
|
68
|
-
class Identity
|
69
|
-
include SimplyStored::Couch
|
70
|
-
belongs_to :instance
|
71
|
-
belongs_to :magazine
|
72
|
-
end
|
73
|
-
|
74
|
-
class Magazine
|
75
|
-
include SimplyStored::Couch
|
76
|
-
has_one :identity, :dependent => :destroy
|
77
|
-
end
|
78
|
-
|
79
|
-
class CouchLogItem
|
80
|
-
include SimplyStored::Couch
|
81
|
-
has_s3_attachment :log_data, :bucket => "bucket-for-monsieur", :access_key => 'abcdef', :secret_access_key => 'secret!'
|
82
|
-
end
|
83
|
-
|
84
|
-
class UniqueUser
|
85
|
-
include SimplyStored::Couch
|
86
|
-
|
87
|
-
property :name
|
88
|
-
validates_uniqueness_of :name
|
89
|
-
end
|
90
|
-
|
91
|
-
class UniqueUserWithAView
|
92
|
-
include SimplyStored::Couch
|
93
|
-
|
94
|
-
view :by_name, :key => :email
|
95
|
-
property :name
|
96
|
-
validates_uniqueness_of :name
|
97
|
-
end
|
98
|
-
|
99
|
-
class CountMe
|
100
|
-
include SimplyStored::Couch
|
101
|
-
|
102
|
-
property :title
|
103
|
-
end
|
104
|
-
|
105
|
-
class DontCountMe
|
106
|
-
include SimplyStored::Couch
|
107
|
-
|
108
|
-
property :title
|
109
|
-
end
|
110
|
-
|
111
|
-
class Journal
|
112
|
-
include SimplyStored::Couch
|
113
|
-
|
114
|
-
has_many :memberships, :dependent => :destroy
|
115
|
-
has_many :readers, :through => :memberships, :dependent => :destroy
|
116
|
-
property :foo
|
117
|
-
end
|
118
|
-
|
119
|
-
class Reader
|
120
|
-
include SimplyStored::Couch
|
121
|
-
|
122
|
-
has_many :memberships, :dependent => :destroy
|
123
|
-
has_many :journals, :through => :memberships
|
124
|
-
end
|
125
|
-
|
126
|
-
class Membership
|
127
|
-
include SimplyStored::Couch
|
128
|
-
|
129
|
-
belongs_to :reader
|
130
|
-
belongs_to :journal
|
131
|
-
end
|
132
|
-
|
133
|
-
class Hemorrhoid
|
134
|
-
include SimplyStored::Couch
|
135
|
-
|
136
|
-
enable_soft_delete
|
137
|
-
|
138
|
-
view :by_nickname_and_size, :key => [:nickname, :size]
|
139
|
-
|
140
|
-
property :nickname
|
141
|
-
property :size
|
142
|
-
belongs_to :user
|
143
|
-
belongs_to :pain
|
144
|
-
belongs_to :spot
|
145
|
-
has_many :sub_hemorrhoids, :dependent => :destroy
|
146
|
-
has_many :easy_sub_hemorrhoids, :dependent => :destroy
|
147
|
-
has_many :rashs, :dependent => :nullify
|
148
|
-
has_many :small_rashs, :dependent => :nullify
|
149
|
-
|
150
|
-
before_destroy :before_destroy_callback
|
151
|
-
after_destroy :after_destroy_callback
|
152
|
-
|
153
|
-
def before_destroy_callback
|
154
|
-
end
|
155
|
-
|
156
|
-
def after_destroy_callback
|
157
|
-
end
|
158
|
-
end
|
159
|
-
|
160
|
-
class SubHemorrhoid
|
161
|
-
include SimplyStored::Couch
|
162
|
-
|
163
|
-
enable_soft_delete
|
164
|
-
|
165
|
-
belongs_to :hemorrhoid
|
166
|
-
end
|
167
|
-
|
168
|
-
class EasySubHemorrhoid
|
169
|
-
include SimplyStored::Couch
|
170
|
-
|
171
|
-
belongs_to :hemorrhoid
|
172
|
-
end
|
173
|
-
|
174
|
-
class Rash
|
175
|
-
include SimplyStored::Couch
|
176
|
-
|
177
|
-
belongs_to :hemorrhoid
|
178
|
-
end
|
179
|
-
|
180
|
-
class SmallRash
|
181
|
-
include SimplyStored::Couch
|
182
|
-
|
183
|
-
enable_soft_delete
|
184
|
-
|
185
|
-
belongs_to :hemorrhoid
|
186
|
-
end
|
187
|
-
|
188
|
-
class Pain
|
189
|
-
include SimplyStored::Couch
|
190
|
-
|
191
|
-
has_many :hemorrhoids
|
192
|
-
has_many :users, :through => :hemorrhoids
|
193
|
-
end
|
194
|
-
|
195
|
-
class Spot
|
196
|
-
include SimplyStored::Couch
|
197
|
-
|
198
|
-
has_one :hemorrhoid
|
199
|
-
end
|
200
|
-
|
201
|
-
class Master
|
202
|
-
include SimplyStored::Couch
|
203
|
-
|
204
|
-
has_many :servants, :dependent => :ignore
|
205
|
-
end
|
206
|
-
|
207
|
-
class Servant
|
208
|
-
include SimplyStored::Couch
|
209
|
-
|
210
|
-
belongs_to :master
|
211
|
-
end
|
212
|
-
|
213
|
-
class Issue
|
214
|
-
include SimplyStored::Couch
|
215
|
-
|
216
|
-
belongs_to :problem
|
217
|
-
belongs_to :big_problem
|
218
|
-
|
219
|
-
property :name
|
220
|
-
end
|
221
|
-
|
222
|
-
class Problem
|
223
|
-
include SimplyStored::Couch
|
224
|
-
|
225
|
-
has_many :issues
|
226
|
-
has_one :issue
|
227
|
-
end
|
228
|
-
|
229
|
-
class BigProblem < Problem
|
230
|
-
|
231
|
-
end
|
232
|
-
|
233
|
-
class Server
|
234
|
-
include SimplyStored::Couch
|
235
|
-
|
236
|
-
property :hostname
|
237
|
-
|
238
|
-
has_and_belongs_to_many :networks, :storing_keys => true
|
239
|
-
has_and_belongs_to_many :subnets, :storing_keys => true
|
240
|
-
has_and_belongs_to_many :ips, :storing_keys => false
|
241
|
-
end
|
242
|
-
|
243
|
-
class Network
|
244
|
-
include SimplyStored::Couch
|
245
|
-
|
246
|
-
property :klass
|
247
|
-
|
248
|
-
has_and_belongs_to_many :servers, :storing_keys => false
|
249
|
-
has_and_belongs_to_many :routers, :storing_keys => false
|
250
|
-
end
|
251
|
-
|
252
|
-
class Subnet < Network
|
253
|
-
has_and_belongs_to_many :servers, :storing_keys => false
|
254
|
-
end
|
255
|
-
|
256
|
-
class Ip
|
257
|
-
include SimplyStored::Couch
|
258
|
-
|
259
|
-
has_and_belongs_to_many :servers, :storing_keys => true
|
260
|
-
end
|
261
|
-
|
262
|
-
class Router
|
263
|
-
include SimplyStored::Couch
|
264
|
-
enable_soft_delete
|
265
|
-
|
266
|
-
property :hostname
|
267
|
-
|
268
|
-
has_and_belongs_to_many :networks, :storing_keys => true
|
269
|
-
end
|
270
|
-
|
271
|
-
class Book
|
272
|
-
include SimplyStored::Couch
|
273
|
-
|
274
|
-
property :title
|
275
|
-
|
276
|
-
has_and_belongs_to_many :authors, :storing_keys => true
|
277
|
-
end
|
278
|
-
|
279
|
-
class Author
|
280
|
-
include SimplyStored::Couch
|
281
|
-
enable_soft_delete
|
282
|
-
|
283
|
-
property :name
|
284
|
-
|
285
|
-
has_and_belongs_to_many :books, :storing_keys => false
|
286
|
-
end
|