modulate 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
@@ -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
|
data/lib/modulate/version.rb
CHANGED
data/spec/dummy/log/test.log
CHANGED
@@ -1193,3 +1193,274 @@ Processing by AccountsController#index as HTML
|
|
1193
1193
|
[1m[35mAccount Load (0.4ms)[0m 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
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
1198
|
+
[1m[35mSQL (2.3ms)[0m INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-05 15:12:31', 'test_account', '2013-04-05 15:12:31')
|
1199
|
+
[1m[36m (0.6ms)[0m [1mCOMMIT[0m
|
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
|
+
[1m[35mAccount Load (0.3ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 71 LIMIT 1
|
1204
|
+
[1m[36m (0.2ms)[0m [1mSELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 71 AND `modulate_documents`.`attachable_type` = 'Account'[0m
|
1205
|
+
Rendered accounts/_modulate_account_documents.html.haml (100.1ms)
|
1206
|
+
[1m[35mModulate::Document Load (0.3ms)[0m 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
|
+
[1m[36mAccount Load (0.3ms)[0m [1mSELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 71 LIMIT 1[0m
|
1214
|
+
[1m[35mModulate::Document Load (0.4ms)[0m SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 71 AND `modulate_documents`.`attachable_type` = 'Account'
|
1215
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
1216
|
+
[1m[35mCACHE (0.0ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 71 LIMIT 1
|
1217
|
+
[1m[36mModulate::Document Exists (0.3ms)[0m [1mSELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '71-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1[0m
|
1218
|
+
[1m[35mSQL (0.3ms)[0m 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
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
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
|
+
[1m[35mAccount Load (0.3ms)[0m 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
|
+
[1m[36m (0.2ms)[0m [1mBEGIN[0m
|
1229
|
+
[1m[35mSQL (2.4ms)[0m INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-05 17:50:49', 'test_account', '2013-04-05 17:50:49')
|
1230
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
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
|
+
[1m[35mAccount Load (0.3ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 72 LIMIT 1
|
1235
|
+
[1m[36m (0.2ms)[0m [1mSELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 72 AND `modulate_documents`.`attachable_type` = 'Account'[0m
|
1236
|
+
Rendered accounts/_modulate_account_documents.html.haml (115.1ms)
|
1237
|
+
[1m[35mModulate::Document Load (0.4ms)[0m 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
|
+
[1m[36mAccount Load (0.3ms)[0m [1mSELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 72 LIMIT 1[0m
|
1245
|
+
[1m[35mModulate::Document Load (0.3ms)[0m SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 72 AND `modulate_documents`.`attachable_type` = 'Account'
|
1246
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
1247
|
+
[1m[35mCACHE (0.0ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 72 LIMIT 1
|
1248
|
+
[1m[36mModulate::Document Exists (0.3ms)[0m [1mSELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '72-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1[0m
|
1249
|
+
[1m[35mSQL (0.3ms)[0m 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
|
+
[1m[36m (0.5ms)[0m [1mCOMMIT[0m
|
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
|
+
[1m[35mAccount Load (0.4ms)[0m 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
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
1260
|
+
[1m[35mSQL (2.3ms)[0m INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-05 17:54:47', 'test_account', '2013-04-05 17:54:47')
|
1261
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
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
|
+
[1m[35mAccount Load (0.3ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 73 LIMIT 1
|
1266
|
+
[1m[36m (0.2ms)[0m [1mSELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 73 AND `modulate_documents`.`attachable_type` = 'Account'[0m
|
1267
|
+
Rendered accounts/_modulate_account_documents.html.haml (101.9ms)
|
1268
|
+
[1m[35mModulate::Document Load (0.4ms)[0m 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
|
+
[1m[36mAccount Load (0.3ms)[0m [1mSELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 73 LIMIT 1[0m
|
1276
|
+
[1m[35mModulate::Document Load (0.4ms)[0m SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 73 AND `modulate_documents`.`attachable_type` = 'Account'
|
1277
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
1278
|
+
[1m[35mCACHE (0.0ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 73 LIMIT 1
|
1279
|
+
[1m[36mModulate::Document Load (0.5ms)[0m [1mSELECT `modulate_documents`.* FROM `modulate_documents` [0m
|
1280
|
+
[1m[35mModulate::Document Exists (0.3ms)[0m 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
|
+
[1m[36m (0.2ms)[0m [1mBEGIN[0m
|
1283
|
+
[1m[35mSQL (2.7ms)[0m INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-05 18:29:41', 'test_account', '2013-04-05 18:29:41')
|
1284
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
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
|
+
[1m[35mAccount Load (0.3ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 74 LIMIT 1
|
1289
|
+
[1m[36m (0.2ms)[0m [1mSELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 74 AND `modulate_documents`.`attachable_type` = 'Account'[0m
|
1290
|
+
Rendered accounts/_modulate_account_documents.html.haml (57.2ms)
|
1291
|
+
[1m[35mModulate::Document Load (0.4ms)[0m 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
|
+
[1m[36mAccount Load (0.3ms)[0m [1mSELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 74 LIMIT 1[0m
|
1299
|
+
[1m[35mModulate::Document Load (0.3ms)[0m SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 74 AND `modulate_documents`.`attachable_type` = 'Account'
|
1300
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
1301
|
+
[1m[35mCACHE (0.0ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 74 LIMIT 1
|
1302
|
+
[1m[36mModulate::Document Exists (0.3ms)[0m [1mSELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '74-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1[0m
|
1303
|
+
[1m[35mSQL (0.3ms)[0m 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
|
+
[1m[36m (0.5ms)[0m [1mCOMMIT[0m
|
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
|
+
[1m[35mAccount Load (0.4ms)[0m 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
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
1313
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-05 18:29:42', 'test_account', '2013-04-05 18:29:42')
|
1314
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
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
|
+
[1m[35mAccount Load (0.3ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 75 LIMIT 1
|
1319
|
+
[1m[36m (0.3ms)[0m [1mSELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 75 AND `modulate_documents`.`attachable_type` = 'Account'[0m
|
1320
|
+
Rendered accounts/_modulate_account_documents.html.haml (2.7ms)
|
1321
|
+
[1m[35mModulate::Document Load (0.3ms)[0m 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
|
+
[1m[36mAccount Load (0.3ms)[0m [1mSELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 75 LIMIT 1[0m
|
1329
|
+
[1m[35mModulate::Document Load (0.3ms)[0m SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 75 AND `modulate_documents`.`attachable_type` = 'Account'
|
1330
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
1331
|
+
[1m[35mCACHE (0.0ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 75 LIMIT 1
|
1332
|
+
[1m[36mModulate::Document Exists (0.3ms)[0m [1mSELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '75-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1[0m
|
1333
|
+
[1m[35mSQL (0.3ms)[0m 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
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
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
|
+
[1m[35mAccount Load (0.3ms)[0m 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
|
+
[1m[36mModulate::Document Load (0.4ms)[0m [1mSELECT `modulate_documents`.* FROM `modulate_documents` ORDER BY `modulate_documents`.`id` DESC LIMIT 1[0m
|
1343
|
+
Connecting to database specified by database.yml
|
1344
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
1345
|
+
[1m[35mSQL (2.8ms)[0m INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-05 18:30:12', 'test_account', '2013-04-05 18:30:12')
|
1346
|
+
[1m[36m (0.5ms)[0m [1mCOMMIT[0m
|
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
|
+
[1m[35mAccount Load (0.3ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 76 LIMIT 1
|
1351
|
+
[1m[36m (0.2ms)[0m [1mSELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 76 AND `modulate_documents`.`attachable_type` = 'Account'[0m
|
1352
|
+
Rendered accounts/_modulate_account_documents.html.haml (106.1ms)
|
1353
|
+
[1m[35mModulate::Document Load (0.4ms)[0m 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
|
+
[1m[36mAccount Load (0.3ms)[0m [1mSELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 76 LIMIT 1[0m
|
1361
|
+
[1m[35mModulate::Document Load (0.4ms)[0m SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 76 AND `modulate_documents`.`attachable_type` = 'Account'
|
1362
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
1363
|
+
[1m[35mCACHE (0.0ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 76 LIMIT 1
|
1364
|
+
[1m[36mModulate::Document Exists (0.4ms)[0m [1mSELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '76-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1[0m
|
1365
|
+
[1m[35mSQL (0.3ms)[0m 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
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
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
|
+
[1m[35mAccount Load (0.3ms)[0m 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
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
1375
|
+
[1m[35mSQL (0.2ms)[0m INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-05 18:30:13', 'test_account', '2013-04-05 18:30:13')
|
1376
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
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
|
+
[1m[35mAccount Load (0.3ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 77 LIMIT 1
|
1381
|
+
[1m[36m (0.3ms)[0m [1mSELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 77 AND `modulate_documents`.`attachable_type` = 'Account'[0m
|
1382
|
+
Rendered accounts/_modulate_account_documents.html.haml (2.6ms)
|
1383
|
+
[1m[35mModulate::Document Load (0.4ms)[0m 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
|
+
[1m[36mAccount Load (0.3ms)[0m [1mSELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 77 LIMIT 1[0m
|
1391
|
+
[1m[35mModulate::Document Load (0.4ms)[0m SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 77 AND `modulate_documents`.`attachable_type` = 'Account'
|
1392
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
1393
|
+
[1m[35mCACHE (0.0ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 77 LIMIT 1
|
1394
|
+
[1m[36mModulate::Document Exists (0.3ms)[0m [1mSELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '77-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1[0m
|
1395
|
+
[1m[35mSQL (0.2ms)[0m 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
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
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
|
+
[1m[35mAccount Load (0.3ms)[0m 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
|
+
[1m[36mModulate::Document Load (0.3ms)[0m [1mSELECT `modulate_documents`.* FROM `modulate_documents` ORDER BY `modulate_documents`.`id` DESC LIMIT 1[0m
|
1405
|
+
Connecting to database specified by database.yml
|
1406
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
1407
|
+
[1m[35mSQL (2.9ms)[0m INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-05 18:38:37', 'test_account', '2013-04-05 18:38:37')
|
1408
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
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
|
+
[1m[35mAccount Load (0.3ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 78 LIMIT 1
|
1413
|
+
[1m[36m (0.3ms)[0m [1mSELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 78 AND `modulate_documents`.`attachable_type` = 'Account'[0m
|
1414
|
+
Rendered accounts/_modulate_account_documents.html.haml (507.6ms)
|
1415
|
+
[1m[35mModulate::Document Load (0.5ms)[0m 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
|
+
[1m[36mAccount Load (0.4ms)[0m [1mSELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 78 LIMIT 1[0m
|
1423
|
+
[1m[35mModulate::Document Load (0.4ms)[0m SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 78 AND `modulate_documents`.`attachable_type` = 'Account'
|
1424
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
1425
|
+
[1m[35mCACHE (0.0ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 78 LIMIT 1
|
1426
|
+
[1m[36mModulate::Document Exists (0.4ms)[0m [1mSELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '78-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1[0m
|
1427
|
+
[1m[35mSQL (0.3ms)[0m 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
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
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
|
+
[1m[35mAccount Load (0.4ms)[0m 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
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
1437
|
+
[1m[35mSQL (0.3ms)[0m INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-05 18:38:39', 'test_account', '2013-04-05 18:38:39')
|
1438
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
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
|
+
[1m[35mAccount Load (0.3ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 79 LIMIT 1
|
1443
|
+
[1m[36m (0.4ms)[0m [1mSELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 79 AND `modulate_documents`.`attachable_type` = 'Account'[0m
|
1444
|
+
Rendered accounts/_modulate_account_documents.html.haml (2.8ms)
|
1445
|
+
[1m[35mModulate::Document Load (0.4ms)[0m 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
|
+
[1m[36mAccount Load (0.3ms)[0m [1mSELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 79 LIMIT 1[0m
|
1453
|
+
[1m[35mModulate::Document Load (0.3ms)[0m SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 79 AND `modulate_documents`.`attachable_type` = 'Account'
|
1454
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
1455
|
+
[1m[35mCACHE (0.0ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 79 LIMIT 1
|
1456
|
+
[1m[36mModulate::Document Exists (0.3ms)[0m [1mSELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '79-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1[0m
|
1457
|
+
[1m[35mSQL (0.3ms)[0m 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
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
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
|
+
[1m[35mAccount Load (0.3ms)[0m 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
|
+
[1m[36mModulate::Document Load (0.3ms)[0m [1mSELECT `modulate_documents`.* FROM `modulate_documents` ORDER BY `modulate_documents`.`id` DESC LIMIT 1[0m
|
@@ -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
|
-
|
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.
|
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:
|
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:
|
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
|