modulate 0.0.9 → 0.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,7 +6,7 @@ class Modulate::Document < ActiveRecord::Base
6
6
 
7
7
  mount_uploader :attachment, Modulate::DocumentUploader
8
8
 
9
- validates :attachable_id, :attachable_type, :bucket, :key, :filename, :content_type, :attachment, presence: true
9
+ validates :attachable_id, :attachable_type, :bucket, :key, :filename, :content_type, :attachment, :label, presence: true
10
10
  validates :key, uniqueness: {scope: :bucket}
11
11
 
12
12
  belongs_to :attachable, polymorphic: true
@@ -36,4 +36,14 @@ class Modulate::Document < ActiveRecord::Base
36
36
  self[:content_type] ||= attachment.file.content_type
37
37
  end
38
38
 
39
+ def label
40
+ self[:label] ||= filename_to_label
41
+ end
42
+
43
+ private
44
+
45
+ def filename_to_label
46
+ File.basename(filename.to_s, File.extname(filename.to_s)).gsub(/\W/, ' ').squeeze(' ').humanize
47
+ end
48
+
39
49
  end
@@ -1,3 +1,3 @@
1
1
  module Modulate
2
- VERSION = "0.0.9"
2
+ VERSION = "0.0.10"
3
3
  end
@@ -1193,3 +1193,274 @@ Processing by AccountsController#index as HTML
1193
1193
  Account Load (0.4ms) SELECT `accounts`.* FROM `accounts`
1194
1194
  Rendered accounts/index.html.haml within layouts/application (1.5ms)
1195
1195
  Completed 200 OK in 15ms (Views: 5.3ms | ActiveRecord: 0.4ms)
1196
+ Connecting to database specified by database.yml
1197
+  (0.1ms) BEGIN
1198
+ SQL (2.3ms) INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-05 15:12:31', 'test_account', '2013-04-05 15:12:31')
1199
+  (0.6ms) COMMIT
1200
+ Started GET "/accounts/71" for 127.0.0.1 at 2013-04-05 11:12:31 -0400
1201
+ Processing by AccountsController#show as HTML
1202
+ Parameters: {"id"=>"71"}
1203
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 71 LIMIT 1
1204
+  (0.2ms) SELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 71 AND `modulate_documents`.`attachable_type` = 'Account'
1205
+ Rendered accounts/_modulate_account_documents.html.haml (100.1ms)
1206
+ Modulate::Document Load (0.3ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 71 AND `modulate_documents`.`attachable_type` = 'Account'
1207
+ Rendered accounts/_modulate_attachments.html.haml (288.2ms)
1208
+ Rendered accounts/show.html.erb within layouts/application (298.3ms)
1209
+ Completed 200 OK in 324ms (Views: 314.0ms | ActiveRecord: 3.3ms)
1210
+ Started PUT "/accounts/71" for 127.0.0.1 at 2013-04-05 11:12:31 -0400
1211
+ Processing by AccountsController#update as HTML
1212
+ Parameters: {"utf8"=>"✓", "account"=>{"modulate_uploads_attributes"=>[{"attachment"=>#<ActionDispatch::Http::UploadedFile:0x007fb8131af068 @original_filename="test.txt", @content_type="text/plain", @headers="Content-Disposition: form-data; name=\"account[modulate_uploads_attributes][][attachment]\"; filename=\"test.txt\"\r\nContent-Type: text/plain\r\nContent-Length: 25\r\n", @tempfile=#<File:/var/folders/lb/j1c12jc524zfb75l84v94qr40000gn/T/RackMultipart20130405-93076-1joqoee>>}]}, "button"=>"", "id"=>"71"}
1213
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 71 LIMIT 1
1214
+ Modulate::Document Load (0.4ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 71 AND `modulate_documents`.`attachable_type` = 'Account'
1215
+  (0.1ms) BEGIN
1216
+ CACHE (0.0ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 71 LIMIT 1
1217
+ Modulate::Document Exists (0.3ms) SELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '71-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1
1218
+ SQL (0.3ms) INSERT INTO `modulate_documents` (`attachable_id`, `attachable_type`, `attached_by_id`, `attachment`, `bucket`, `content_type`, `created_at`, `filename`, `key`, `label`, `public`, `updated_at`) VALUES (71, 'Account', NULL, '71-test.txt', 'Dummy::Account', 'text/plain', '2013-04-05 15:12:32', 'test.txt', '71-test.txt', NULL, 0, '2013-04-05 15:12:32')
1219
+  (0.4ms) COMMIT
1220
+ Redirected to http://www.example.com/accounts
1221
+ Completed 302 Found in 179ms (ActiveRecord: 1.7ms)
1222
+ Started GET "/accounts" for 127.0.0.1 at 2013-04-05 11:12:32 -0400
1223
+ Processing by AccountsController#index as HTML
1224
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts`
1225
+ Rendered accounts/index.html.haml within layouts/application (1.3ms)
1226
+ Completed 200 OK in 15ms (Views: 4.9ms | ActiveRecord: 0.3ms)
1227
+ Connecting to database specified by database.yml
1228
+  (0.2ms) BEGIN
1229
+ SQL (2.4ms) INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-05 17:50:49', 'test_account', '2013-04-05 17:50:49')
1230
+  (0.4ms) COMMIT
1231
+ Started GET "/accounts/72" for 127.0.0.1 at 2013-04-05 13:50:49 -0400
1232
+ Processing by AccountsController#show as HTML
1233
+ Parameters: {"id"=>"72"}
1234
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 72 LIMIT 1
1235
+  (0.2ms) SELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 72 AND `modulate_documents`.`attachable_type` = 'Account'
1236
+ Rendered accounts/_modulate_account_documents.html.haml (115.1ms)
1237
+ Modulate::Document Load (0.4ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 72 AND `modulate_documents`.`attachable_type` = 'Account'
1238
+ Rendered accounts/_modulate_attachments.html.haml (354.4ms)
1239
+ Rendered accounts/show.html.erb within layouts/application (367.5ms)
1240
+ Completed 200 OK in 475ms (Views: 401.7ms | ActiveRecord: 3.3ms)
1241
+ Started PUT "/accounts/72" for 127.0.0.1 at 2013-04-05 13:50:50 -0400
1242
+ Processing by AccountsController#update as HTML
1243
+ Parameters: {"utf8"=>"✓", "account"=>{"modulate_uploads_attributes"=>[{"attachment"=>#<ActionDispatch::Http::UploadedFile:0x007faf6ca020f8 @original_filename="test.txt", @content_type="text/plain", @headers="Content-Disposition: form-data; name=\"account[modulate_uploads_attributes][][attachment]\"; filename=\"test.txt\"\r\nContent-Type: text/plain\r\nContent-Length: 25\r\n", @tempfile=#<File:/var/folders/lb/j1c12jc524zfb75l84v94qr40000gn/T/RackMultipart20130405-99143-1616owr>>}]}, "button"=>"", "id"=>"72"}
1244
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 72 LIMIT 1
1245
+ Modulate::Document Load (0.3ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 72 AND `modulate_documents`.`attachable_type` = 'Account'
1246
+  (0.1ms) BEGIN
1247
+ CACHE (0.0ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 72 LIMIT 1
1248
+ Modulate::Document Exists (0.3ms) SELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '72-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1
1249
+ SQL (0.3ms) INSERT INTO `modulate_documents` (`attachable_id`, `attachable_type`, `attached_by_id`, `attachment`, `bucket`, `content_type`, `created_at`, `filename`, `key`, `label`, `public`, `updated_at`) VALUES (72, 'Account', NULL, '72-test.txt', 'Dummy::Account', 'text/plain', '2013-04-05 17:51:28', 'test.txt', '72-test.txt', 'Test', 0, '2013-04-05 17:51:28')
1250
+  (0.5ms) COMMIT
1251
+ Redirected to http://www.example.com/accounts
1252
+ Completed 302 Found in 40558ms (ActiveRecord: 1.8ms)
1253
+ Started GET "/accounts" for 127.0.0.1 at 2013-04-05 13:51:30 -0400
1254
+ Processing by AccountsController#index as HTML
1255
+ Account Load (0.4ms) SELECT `accounts`.* FROM `accounts`
1256
+ Rendered accounts/index.html.haml within layouts/application (1.2ms)
1257
+ Completed 200 OK in 15ms (Views: 4.9ms | ActiveRecord: 0.4ms)
1258
+ Connecting to database specified by database.yml
1259
+  (0.1ms) BEGIN
1260
+ SQL (2.3ms) INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-05 17:54:47', 'test_account', '2013-04-05 17:54:47')
1261
+  (0.4ms) COMMIT
1262
+ Started GET "/accounts/73" for 127.0.0.1 at 2013-04-05 13:54:47 -0400
1263
+ Processing by AccountsController#show as HTML
1264
+ Parameters: {"id"=>"73"}
1265
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 73 LIMIT 1
1266
+  (0.2ms) SELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 73 AND `modulate_documents`.`attachable_type` = 'Account'
1267
+ Rendered accounts/_modulate_account_documents.html.haml (101.9ms)
1268
+ Modulate::Document Load (0.4ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 73 AND `modulate_documents`.`attachable_type` = 'Account'
1269
+ Rendered accounts/_modulate_attachments.html.haml (284.3ms)
1270
+ Rendered accounts/show.html.erb within layouts/application (294.1ms)
1271
+ Completed 200 OK in 321ms (Views: 311.7ms | ActiveRecord: 3.4ms)
1272
+ Started PUT "/accounts/73" for 127.0.0.1 at 2013-04-05 13:54:48 -0400
1273
+ Processing by AccountsController#update as HTML
1274
+ Parameters: {"utf8"=>"✓", "account"=>{"modulate_uploads_attributes"=>[{"attachment"=>#<ActionDispatch::Http::UploadedFile:0x007f9e03a946a8 @original_filename="test.txt", @content_type="text/plain", @headers="Content-Disposition: form-data; name=\"account[modulate_uploads_attributes][][attachment]\"; filename=\"test.txt\"\r\nContent-Type: text/plain\r\nContent-Length: 25\r\n", @tempfile=#<File:/var/folders/lb/j1c12jc524zfb75l84v94qr40000gn/T/RackMultipart20130405-99705-ou3on4>>}]}, "button"=>"", "id"=>"73"}
1275
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 73 LIMIT 1
1276
+ Modulate::Document Load (0.4ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 73 AND `modulate_documents`.`attachable_type` = 'Account'
1277
+  (0.1ms) BEGIN
1278
+ CACHE (0.0ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 73 LIMIT 1
1279
+ Modulate::Document Load (0.5ms) SELECT `modulate_documents`.* FROM `modulate_documents` 
1280
+ Modulate::Document Exists (0.3ms) SELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '73-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1
1281
+ Connecting to database specified by database.yml
1282
+  (0.2ms) BEGIN
1283
+ SQL (2.7ms) INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-05 18:29:41', 'test_account', '2013-04-05 18:29:41')
1284
+  (0.4ms) COMMIT
1285
+ Started GET "/accounts/74" for 127.0.0.1 at 2013-04-05 14:29:42 -0400
1286
+ Processing by AccountsController#show as HTML
1287
+ Parameters: {"id"=>"74"}
1288
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 74 LIMIT 1
1289
+  (0.2ms) SELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 74 AND `modulate_documents`.`attachable_type` = 'Account'
1290
+ Rendered accounts/_modulate_account_documents.html.haml (57.2ms)
1291
+ Modulate::Document Load (0.4ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 74 AND `modulate_documents`.`attachable_type` = 'Account'
1292
+ Rendered accounts/_modulate_attachments.html.haml (239.8ms)
1293
+ Rendered accounts/show.html.erb within layouts/application (293.8ms)
1294
+ Completed 200 OK in 366ms (Views: 355.0ms | ActiveRecord: 4.4ms)
1295
+ Started PUT "/accounts/74" for 127.0.0.1 at 2013-04-05 14:29:42 -0400
1296
+ Processing by AccountsController#update as HTML
1297
+ Parameters: {"utf8"=>"✓", "account"=>{"modulate_uploads_attributes"=>[{"attachment"=>#<ActionDispatch::Http::UploadedFile:0x007fd3e33d95c8 @original_filename="test.txt", @content_type="text/plain", @headers="Content-Disposition: form-data; name=\"account[modulate_uploads_attributes][][attachment]\"; filename=\"test.txt\"\r\nContent-Type: text/plain\r\nContent-Length: 25\r\n", @tempfile=#<File:/var/folders/lb/j1c12jc524zfb75l84v94qr40000gn/T/RackMultipart20130405-275-1qzfay>>}]}, "button"=>"", "id"=>"74"}
1298
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 74 LIMIT 1
1299
+ Modulate::Document Load (0.3ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 74 AND `modulate_documents`.`attachable_type` = 'Account'
1300
+  (0.1ms) BEGIN
1301
+ CACHE (0.0ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 74 LIMIT 1
1302
+ Modulate::Document Exists (0.3ms) SELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '74-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1
1303
+ SQL (0.3ms) INSERT INTO `modulate_documents` (`attachable_id`, `attachable_type`, `attached_by_id`, `attachment`, `bucket`, `content_type`, `created_at`, `filename`, `key`, `label`, `public`, `updated_at`) VALUES (74, 'Account', NULL, '74-test.txt', 'Dummy::Account', 'text/plain', '2013-04-05 18:29:42', 'test.txt', '74-test.txt', 'Test', 0, '2013-04-05 18:29:42')
1304
+  (0.5ms) COMMIT
1305
+ Redirected to http://www.example.com/accounts
1306
+ Completed 302 Found in 180ms (ActiveRecord: 1.8ms)
1307
+ Started GET "/accounts" for 127.0.0.1 at 2013-04-05 14:29:42 -0400
1308
+ Processing by AccountsController#index as HTML
1309
+ Account Load (0.4ms) SELECT `accounts`.* FROM `accounts`
1310
+ Rendered accounts/index.html.haml within layouts/application (1.2ms)
1311
+ Completed 200 OK in 15ms (Views: 4.7ms | ActiveRecord: 0.4ms)
1312
+  (0.1ms) BEGIN
1313
+ SQL (0.2ms) INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-05 18:29:42', 'test_account', '2013-04-05 18:29:42')
1314
+  (0.4ms) COMMIT
1315
+ Started GET "/accounts/75" for 127.0.0.1 at 2013-04-05 14:29:42 -0400
1316
+ Processing by AccountsController#show as HTML
1317
+ Parameters: {"id"=>"75"}
1318
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 75 LIMIT 1
1319
+  (0.3ms) SELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 75 AND `modulate_documents`.`attachable_type` = 'Account'
1320
+ Rendered accounts/_modulate_account_documents.html.haml (2.7ms)
1321
+ Modulate::Document Load (0.3ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 75 AND `modulate_documents`.`attachable_type` = 'Account'
1322
+ Rendered accounts/_modulate_attachments.html.haml (37.6ms)
1323
+ Rendered accounts/show.html.erb within layouts/application (38.1ms)
1324
+ Completed 200 OK in 43ms (Views: 40.1ms | ActiveRecord: 0.9ms)
1325
+ Started PUT "/accounts/75" for 127.0.0.1 at 2013-04-05 14:29:43 -0400
1326
+ Processing by AccountsController#update as HTML
1327
+ Parameters: {"utf8"=>"✓", "account"=>{"modulate_uploads_attributes"=>[{"attachment"=>#<ActionDispatch::Http::UploadedFile:0x007fd3e68802b8 @original_filename="test.txt", @content_type="text/plain", @headers="Content-Disposition: form-data; name=\"account[modulate_uploads_attributes][][attachment]\"; filename=\"test.txt\"\r\nContent-Type: text/plain\r\nContent-Length: 25\r\n", @tempfile=#<File:/var/folders/lb/j1c12jc524zfb75l84v94qr40000gn/T/RackMultipart20130405-275-1t092qi>>}]}, "button"=>"", "id"=>"75"}
1328
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 75 LIMIT 1
1329
+ Modulate::Document Load (0.3ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 75 AND `modulate_documents`.`attachable_type` = 'Account'
1330
+  (0.1ms) BEGIN
1331
+ CACHE (0.0ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 75 LIMIT 1
1332
+ Modulate::Document Exists (0.3ms) SELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '75-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1
1333
+ SQL (0.3ms) INSERT INTO `modulate_documents` (`attachable_id`, `attachable_type`, `attached_by_id`, `attachment`, `bucket`, `content_type`, `created_at`, `filename`, `key`, `label`, `public`, `updated_at`) VALUES (75, 'Account', NULL, '75-test.txt', 'Dummy::Account', 'text/plain', '2013-04-05 18:29:43', 'test.txt', '75-test.txt', 'Test', 0, '2013-04-05 18:29:43')
1334
+  (0.4ms) COMMIT
1335
+ Redirected to http://www.example.com/accounts
1336
+ Completed 302 Found in 33ms (ActiveRecord: 1.7ms)
1337
+ Started GET "/accounts" for 127.0.0.1 at 2013-04-05 14:29:43 -0400
1338
+ Processing by AccountsController#index as HTML
1339
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts`
1340
+ Rendered accounts/index.html.haml within layouts/application (0.1ms)
1341
+ Completed 200 OK in 13ms (Views: 2.9ms | ActiveRecord: 0.3ms)
1342
+ Modulate::Document Load (0.4ms) SELECT `modulate_documents`.* FROM `modulate_documents` ORDER BY `modulate_documents`.`id` DESC LIMIT 1
1343
+ Connecting to database specified by database.yml
1344
+  (0.1ms) BEGIN
1345
+ SQL (2.8ms) INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-05 18:30:12', 'test_account', '2013-04-05 18:30:12')
1346
+  (0.5ms) COMMIT
1347
+ Started GET "/accounts/76" for 127.0.0.1 at 2013-04-05 14:30:12 -0400
1348
+ Processing by AccountsController#show as HTML
1349
+ Parameters: {"id"=>"76"}
1350
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 76 LIMIT 1
1351
+  (0.2ms) SELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 76 AND `modulate_documents`.`attachable_type` = 'Account'
1352
+ Rendered accounts/_modulate_account_documents.html.haml (106.1ms)
1353
+ Modulate::Document Load (0.4ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 76 AND `modulate_documents`.`attachable_type` = 'Account'
1354
+ Rendered accounts/_modulate_attachments.html.haml (294.8ms)
1355
+ Rendered accounts/show.html.erb within layouts/application (304.0ms)
1356
+ Completed 200 OK in 380ms (Views: 319.0ms | ActiveRecord: 3.4ms)
1357
+ Started PUT "/accounts/76" for 127.0.0.1 at 2013-04-05 14:30:13 -0400
1358
+ Processing by AccountsController#update as HTML
1359
+ Parameters: {"utf8"=>"✓", "account"=>{"modulate_uploads_attributes"=>[{"attachment"=>#<ActionDispatch::Http::UploadedFile:0x007ff22f641ad0 @original_filename="test.txt", @content_type="text/plain", @headers="Content-Disposition: form-data; name=\"account[modulate_uploads_attributes][][attachment]\"; filename=\"test.txt\"\r\nContent-Type: text/plain\r\nContent-Length: 25\r\n", @tempfile=#<File:/var/folders/lb/j1c12jc524zfb75l84v94qr40000gn/T/RackMultipart20130405-371-bu5duy>>}]}, "button"=>"", "id"=>"76"}
1360
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 76 LIMIT 1
1361
+ Modulate::Document Load (0.4ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 76 AND `modulate_documents`.`attachable_type` = 'Account'
1362
+  (0.1ms) BEGIN
1363
+ CACHE (0.0ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 76 LIMIT 1
1364
+ Modulate::Document Exists (0.4ms) SELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '76-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1
1365
+ SQL (0.3ms) INSERT INTO `modulate_documents` (`attachable_id`, `attachable_type`, `attached_by_id`, `attachment`, `bucket`, `content_type`, `created_at`, `filename`, `key`, `label`, `public`, `updated_at`) VALUES (76, 'Account', NULL, '76-test.txt', 'Dummy::Account', 'text/plain', '2013-04-05 18:30:13', 'test.txt', '76-test.txt', 'Test', 0, '2013-04-05 18:30:13')
1366
+  (0.4ms) COMMIT
1367
+ Redirected to http://www.example.com/accounts
1368
+ Completed 302 Found in 227ms (ActiveRecord: 1.9ms)
1369
+ Started GET "/accounts" for 127.0.0.1 at 2013-04-05 14:30:13 -0400
1370
+ Processing by AccountsController#index as HTML
1371
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts`
1372
+ Rendered accounts/index.html.haml within layouts/application (1.2ms)
1373
+ Completed 200 OK in 16ms (Views: 4.7ms | ActiveRecord: 0.3ms)
1374
+  (0.1ms) BEGIN
1375
+ SQL (0.2ms) INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-05 18:30:13', 'test_account', '2013-04-05 18:30:13')
1376
+  (0.4ms) COMMIT
1377
+ Started GET "/accounts/77" for 127.0.0.1 at 2013-04-05 14:30:13 -0400
1378
+ Processing by AccountsController#show as HTML
1379
+ Parameters: {"id"=>"77"}
1380
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 77 LIMIT 1
1381
+  (0.3ms) SELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 77 AND `modulate_documents`.`attachable_type` = 'Account'
1382
+ Rendered accounts/_modulate_account_documents.html.haml (2.6ms)
1383
+ Modulate::Document Load (0.4ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 77 AND `modulate_documents`.`attachable_type` = 'Account'
1384
+ Rendered accounts/_modulate_attachments.html.haml (38.7ms)
1385
+ Rendered accounts/show.html.erb within layouts/application (39.1ms)
1386
+ Completed 200 OK in 44ms (Views: 41.1ms | ActiveRecord: 1.0ms)
1387
+ Started PUT "/accounts/77" for 127.0.0.1 at 2013-04-05 14:30:13 -0400
1388
+ Processing by AccountsController#update as HTML
1389
+ Parameters: {"utf8"=>"✓", "account"=>{"modulate_uploads_attributes"=>[{"attachment"=>#<ActionDispatch::Http::UploadedFile:0x007ff22e5e17a8 @original_filename="test.txt", @content_type="text/plain", @headers="Content-Disposition: form-data; name=\"account[modulate_uploads_attributes][][attachment]\"; filename=\"test.txt\"\r\nContent-Type: text/plain\r\nContent-Length: 25\r\n", @tempfile=#<File:/var/folders/lb/j1c12jc524zfb75l84v94qr40000gn/T/RackMultipart20130405-371-j8kgzu>>}]}, "button"=>"", "id"=>"77"}
1390
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 77 LIMIT 1
1391
+ Modulate::Document Load (0.4ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 77 AND `modulate_documents`.`attachable_type` = 'Account'
1392
+  (0.1ms) BEGIN
1393
+ CACHE (0.0ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 77 LIMIT 1
1394
+ Modulate::Document Exists (0.3ms) SELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '77-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1
1395
+ SQL (0.2ms) INSERT INTO `modulate_documents` (`attachable_id`, `attachable_type`, `attached_by_id`, `attachment`, `bucket`, `content_type`, `created_at`, `filename`, `key`, `label`, `public`, `updated_at`) VALUES (77, 'Account', NULL, '77-test.txt', 'Dummy::Account', 'text/plain', '2013-04-05 18:30:13', 'test.txt', '77-test.txt', 'Test', 0, '2013-04-05 18:30:13')
1396
+  (0.4ms) COMMIT
1397
+ Redirected to http://www.example.com/accounts
1398
+ Completed 302 Found in 35ms (ActiveRecord: 1.7ms)
1399
+ Started GET "/accounts" for 127.0.0.1 at 2013-04-05 14:30:13 -0400
1400
+ Processing by AccountsController#index as HTML
1401
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts`
1402
+ Rendered accounts/index.html.haml within layouts/application (0.1ms)
1403
+ Completed 200 OK in 13ms (Views: 2.9ms | ActiveRecord: 0.3ms)
1404
+ Modulate::Document Load (0.3ms) SELECT `modulate_documents`.* FROM `modulate_documents` ORDER BY `modulate_documents`.`id` DESC LIMIT 1
1405
+ Connecting to database specified by database.yml
1406
+  (0.1ms) BEGIN
1407
+ SQL (2.9ms) INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-05 18:38:37', 'test_account', '2013-04-05 18:38:37')
1408
+  (0.4ms) COMMIT
1409
+ Started GET "/accounts/78" for 127.0.0.1 at 2013-04-05 14:38:37 -0400
1410
+ Processing by AccountsController#show as HTML
1411
+ Parameters: {"id"=>"78"}
1412
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 78 LIMIT 1
1413
+  (0.3ms) SELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 78 AND `modulate_documents`.`attachable_type` = 'Account'
1414
+ Rendered accounts/_modulate_account_documents.html.haml (507.6ms)
1415
+ Modulate::Document Load (0.5ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 78 AND `modulate_documents`.`attachable_type` = 'Account'
1416
+ Rendered accounts/_modulate_attachments.html.haml (826.9ms)
1417
+ Rendered accounts/show.html.erb within layouts/application (836.5ms)
1418
+ Completed 200 OK in 913ms (Views: 739.8ms | ActiveRecord: 115.4ms)
1419
+ Started PUT "/accounts/78" for 127.0.0.1 at 2013-04-05 14:38:39 -0400
1420
+ Processing by AccountsController#update as HTML
1421
+ Parameters: {"utf8"=>"✓", "account"=>{"modulate_uploads_attributes"=>[{"attachment"=>#<ActionDispatch::Http::UploadedFile:0x007fd2d6434f58 @original_filename="test.txt", @content_type="text/plain", @headers="Content-Disposition: form-data; name=\"account[modulate_uploads_attributes][][attachment]\"; filename=\"test.txt\"\r\nContent-Type: text/plain\r\nContent-Length: 25\r\n", @tempfile=#<File:/var/folders/lb/j1c12jc524zfb75l84v94qr40000gn/T/RackMultipart20130405-1753-1wbgtcv>>}]}, "button"=>"", "id"=>"78"}
1422
+ Account Load (0.4ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 78 LIMIT 1
1423
+ Modulate::Document Load (0.4ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 78 AND `modulate_documents`.`attachable_type` = 'Account'
1424
+  (0.1ms) BEGIN
1425
+ CACHE (0.0ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 78 LIMIT 1
1426
+ Modulate::Document Exists (0.4ms) SELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '78-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1
1427
+ SQL (0.3ms) INSERT INTO `modulate_documents` (`attachable_id`, `attachable_type`, `attached_by_id`, `attachment`, `bucket`, `content_type`, `created_at`, `filename`, `key`, `label`, `public`, `updated_at`) VALUES (78, 'Account', NULL, '78-test.txt', 'Dummy::Account', 'text/plain', '2013-04-05 18:38:39', 'test.txt', '78-test.txt', 'Test', 0, '2013-04-05 18:38:39')
1428
+  (0.4ms) COMMIT
1429
+ Redirected to http://www.example.com/accounts
1430
+ Completed 302 Found in 283ms (ActiveRecord: 2.1ms)
1431
+ Started GET "/accounts" for 127.0.0.1 at 2013-04-05 14:38:39 -0400
1432
+ Processing by AccountsController#index as HTML
1433
+ Account Load (0.4ms) SELECT `accounts`.* FROM `accounts`
1434
+ Rendered accounts/index.html.haml within layouts/application (1.2ms)
1435
+ Completed 200 OK in 16ms (Views: 4.8ms | ActiveRecord: 0.4ms)
1436
+  (0.1ms) BEGIN
1437
+ SQL (0.3ms) INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-05 18:38:39', 'test_account', '2013-04-05 18:38:39')
1438
+  (0.4ms) COMMIT
1439
+ Started GET "/accounts/79" for 127.0.0.1 at 2013-04-05 14:38:39 -0400
1440
+ Processing by AccountsController#show as HTML
1441
+ Parameters: {"id"=>"79"}
1442
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 79 LIMIT 1
1443
+  (0.4ms) SELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 79 AND `modulate_documents`.`attachable_type` = 'Account'
1444
+ Rendered accounts/_modulate_account_documents.html.haml (2.8ms)
1445
+ Modulate::Document Load (0.4ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 79 AND `modulate_documents`.`attachable_type` = 'Account'
1446
+ Rendered accounts/_modulate_attachments.html.haml (38.2ms)
1447
+ Rendered accounts/show.html.erb within layouts/application (38.6ms)
1448
+ Completed 200 OK in 43ms (Views: 40.7ms | ActiveRecord: 1.0ms)
1449
+ Started PUT "/accounts/79" for 127.0.0.1 at 2013-04-05 14:38:39 -0400
1450
+ Processing by AccountsController#update as HTML
1451
+ Parameters: {"utf8"=>"✓", "account"=>{"modulate_uploads_attributes"=>[{"attachment"=>#<ActionDispatch::Http::UploadedFile:0x007fd2d7e10b70 @original_filename="test.txt", @content_type="text/plain", @headers="Content-Disposition: form-data; name=\"account[modulate_uploads_attributes][][attachment]\"; filename=\"test.txt\"\r\nContent-Type: text/plain\r\nContent-Length: 25\r\n", @tempfile=#<File:/var/folders/lb/j1c12jc524zfb75l84v94qr40000gn/T/RackMultipart20130405-1753-1kcqkzh>>}]}, "button"=>"", "id"=>"79"}
1452
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 79 LIMIT 1
1453
+ Modulate::Document Load (0.3ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 79 AND `modulate_documents`.`attachable_type` = 'Account'
1454
+  (0.1ms) BEGIN
1455
+ CACHE (0.0ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 79 LIMIT 1
1456
+ Modulate::Document Exists (0.3ms) SELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '79-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1
1457
+ SQL (0.3ms) INSERT INTO `modulate_documents` (`attachable_id`, `attachable_type`, `attached_by_id`, `attachment`, `bucket`, `content_type`, `created_at`, `filename`, `key`, `label`, `public`, `updated_at`) VALUES (79, 'Account', NULL, '79-test.txt', 'Dummy::Account', 'text/plain', '2013-04-05 18:38:39', 'test.txt', '79-test.txt', 'Test', 0, '2013-04-05 18:38:39')
1458
+  (0.4ms) COMMIT
1459
+ Redirected to http://www.example.com/accounts
1460
+ Completed 302 Found in 34ms (ActiveRecord: 1.8ms)
1461
+ Started GET "/accounts" for 127.0.0.1 at 2013-04-05 14:38:39 -0400
1462
+ Processing by AccountsController#index as HTML
1463
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts`
1464
+ Rendered accounts/index.html.haml within layouts/application (0.1ms)
1465
+ Completed 200 OK in 14ms (Views: 3.0ms | ActiveRecord: 0.3ms)
1466
+ Modulate::Document Load (0.3ms) SELECT `modulate_documents`.* FROM `modulate_documents` ORDER BY `modulate_documents`.`id` DESC LIMIT 1
@@ -0,0 +1 @@
1
+ This is a test document.
@@ -4,11 +4,18 @@ describe "uploading a document" do
4
4
 
5
5
  let(:account) { FactoryGirl.create(:account) }
6
6
 
7
- it "stores the file to Riak" do
7
+ before :each do
8
8
  visit "/accounts/#{account.id}"
9
9
  attach_file('account_modulate_uploads_attributes_0_attachment', Rails.root.join('../../', 'spec', 'fixtures', 'test.txt'))
10
10
  click_button "Update Account"
11
+ end
12
+
13
+ it "stores the file to Riak" do
11
14
  expect(page).to have_content('successfully')
12
15
  end
13
16
 
17
+ it "sets the label" do
18
+ expect(Modulate::Document.last.label).to eq('Test')
19
+ end
20
+
14
21
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: modulate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -254,6 +254,7 @@ files:
254
254
  - spec/dummy/public/uploads/tmp/20130405-1101-92040-3866/test.txt
255
255
  - spec/dummy/public/uploads/tmp/20130405-1103-92315-4868/test.txt
256
256
  - spec/dummy/public/uploads/tmp/20130405-1104-92379-0419/test.txt
257
+ - spec/dummy/public/uploads/tmp/20130405-1354-99705-5773/test.txt
257
258
  - spec/dummy/Rakefile
258
259
  - spec/dummy/README.rdoc
259
260
  - spec/dummy/script/rails
@@ -306,7 +307,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
306
307
  version: '0'
307
308
  segments:
308
309
  - 0
309
- hash: 2750575772189229921
310
+ hash: -468336500448220773
310
311
  required_rubygems_version: !ruby/object:Gem::Requirement
311
312
  none: false
312
313
  requirements:
@@ -315,7 +316,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
315
316
  version: '0'
316
317
  segments:
317
318
  - 0
318
- hash: 2750575772189229921
319
+ hash: -468336500448220773
319
320
  requirements: []
320
321
  rubyforge_project:
321
322
  rubygems_version: 1.8.24
@@ -397,6 +398,7 @@ test_files:
397
398
  - spec/dummy/public/uploads/tmp/20130405-1101-92040-3866/test.txt
398
399
  - spec/dummy/public/uploads/tmp/20130405-1103-92315-4868/test.txt
399
400
  - spec/dummy/public/uploads/tmp/20130405-1104-92379-0419/test.txt
401
+ - spec/dummy/public/uploads/tmp/20130405-1354-99705-5773/test.txt
400
402
  - spec/dummy/Rakefile
401
403
  - spec/dummy/README.rdoc
402
404
  - spec/dummy/script/rails