modulate 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/generators/modulate/templates/_modulate_attachments.html.haml +4 -4
- data/lib/generators/modulate/templates/_modulate_documents.html.haml +2 -2
- data/lib/modulate/relation.rb +3 -1
- data/lib/modulate/version.rb +1 -1
- data/spec/dummy/log/test.log +240 -0
- data/spec/modulate_spec.rb +3 -1
- metadata +4 -5
- data/app/views/modulate/documents/show.html.haml +0 -0
@@ -1,10 +1,10 @@
|
|
1
|
-
= semantic_form_for @<%=
|
2
|
-
= render "modulate_<%=
|
1
|
+
= semantic_form_for @<%= name.last %> do |f|
|
2
|
+
= render "modulate_<%= partial_name %>_documents", f: f
|
3
3
|
|
4
4
|
= f.inputs do
|
5
|
-
= f.semantic_fields_for :
|
5
|
+
= f.semantic_fields_for :modulate_uploads, @<%= name.last %>.modulate_documents.build do |d|
|
6
6
|
= d.input(:attachment, as: :file, label: 'Choose document to attach', required: true,
|
7
|
-
input_html: {multiple: true, name: "<%=
|
7
|
+
input_html: {multiple: true, name: "<%= name.last %>[modulate_uploads_attributes][][attachment]"}).sub('[attachment][]', '[attachment]').html_safe
|
8
8
|
|
9
9
|
= f.actions do
|
10
10
|
= f.action :submit, as: 'button', button_html: {class: 'btn btn-primary'}
|
@@ -9,8 +9,8 @@
|
|
9
9
|
%th
|
10
10
|
%th
|
11
11
|
%tbody
|
12
|
-
- if @<%=
|
13
|
-
- @<%=
|
12
|
+
- if @<%= name.last %>.modulate_documents.any?
|
13
|
+
- @<%= name.last %>.modulate_documents.each do |document|
|
14
14
|
- next unless document.persisted?
|
15
15
|
= f.fields_for :modulate_documents, document do |d|
|
16
16
|
%tr
|
data/lib/modulate/relation.rb
CHANGED
@@ -1,7 +1,9 @@
|
|
1
1
|
module Modulate::Relation
|
2
2
|
|
3
3
|
def modulate(name=:modulate_documents, options={})
|
4
|
-
has_many name, {as: :attachable, class_name: "Modulate::Document"}.reverse_merge(options)
|
4
|
+
has_many name, {as: :attachable, class_name: "Modulate::Document"}.reverse_merge(options) # for uploading
|
5
|
+
has_many :modulate_uploads, as: :attachable, class_name: 'Modulate::Document' # for creating
|
6
|
+
accepts_nested_attributes_for :modulate_uploads
|
5
7
|
accepts_nested_attributes_for name
|
6
8
|
attr_accessor :"#{Modulate.configuration.user_method}" unless Modulate.configuration.user_method == nil
|
7
9
|
end
|
data/lib/modulate/version.rb
CHANGED
data/spec/dummy/log/test.log
CHANGED
@@ -515,3 +515,243 @@ Processing by AccountsController#index as HTML
|
|
515
515
|
[1m[36mAccount Load (0.4ms)[0m [1mSELECT `accounts`.* FROM `accounts` [0m
|
516
516
|
Rendered accounts/index.html.haml within layouts/application (1.4ms)
|
517
517
|
Completed 200 OK in 14ms (Views: 5.6ms | ActiveRecord: 0.4ms)
|
518
|
+
Connecting to database specified by database.yml
|
519
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
520
|
+
[1m[35mSQL (2.5ms)[0m INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-03 19:09:46', 'test_account', '2013-04-03 19:09:46')
|
521
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
522
|
+
Started GET "/accounts/45" for 127.0.0.1 at 2013-04-03 15:09:46 -0400
|
523
|
+
Processing by AccountsController#show as HTML
|
524
|
+
Parameters: {"id"=>"45"}
|
525
|
+
[1m[35mAccount Load (0.4ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 45 LIMIT 1
|
526
|
+
[1m[36m (0.3ms)[0m [1mSELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 45 AND `modulate_documents`.`attachable_type` = 'Account'[0m
|
527
|
+
Rendered accounts/_modulate_account_documents.html.haml (145.1ms)
|
528
|
+
Rendered accounts/_modulate_attachments.html.haml (401.6ms)
|
529
|
+
Rendered accounts/show.html.erb within layouts/application (419.2ms)
|
530
|
+
Completed 200 OK in 466ms (Views: 417.3ms | ActiveRecord: 31.5ms)
|
531
|
+
Started PUT "/accounts/45" for 127.0.0.1 at 2013-04-03 15:09:47 -0400
|
532
|
+
Processing by AccountsController#update as HTML
|
533
|
+
Parameters: {"utf8"=>"✓", "account"=>{"modulate_documents_attributes"=>[{"attachment"=>#<ActionDispatch::Http::UploadedFile:0x007fccbdc70560 @original_filename="test.txt", @content_type="text/plain", @headers="Content-Disposition: form-data; name=\"account[modulate_documents_attributes][][attachment]\"; filename=\"test.txt\"\r\nContent-Type: text/plain\r\nContent-Length: 25\r\n", @tempfile=#<File:/var/folders/lb/j1c12jc524zfb75l84v94qr40000gn/T/RackMultipart20130403-61908-rxeeij>>}]}, "button"=>"", "id"=>"45"}
|
534
|
+
[1m[35mAccount Load (0.3ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 45 LIMIT 1
|
535
|
+
[1m[36mModulate::Document Load (0.3ms)[0m [1mSELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 45 AND `modulate_documents`.`attachable_type` = 'Account'[0m
|
536
|
+
[1m[35m (0.1ms)[0m BEGIN
|
537
|
+
[1m[36mCACHE (0.0ms)[0m [1mSELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 45 LIMIT 1[0m
|
538
|
+
[1m[35mModulate::Document Exists (0.4ms)[0m SELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '45-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1
|
539
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO `modulate_documents` (`attachable_id`, `attachable_type`, `attached_by_id`, `attachment`, `bucket`, `content_type`, `created_at`, `filename`, `key`, `label`, `public`, `updated_at`) VALUES (45, 'Account', 1, '45-test.txt', 'Dummy::Account', 'text/plain', '2013-04-03 19:09:47', 'test.txt', '45-test.txt', NULL, 0, '2013-04-03 19:09:47')[0m
|
540
|
+
[1m[35m (0.4ms)[0m COMMIT
|
541
|
+
Redirected to http://www.example.com/accounts
|
542
|
+
Completed 302 Found in 142ms (ActiveRecord: 1.8ms)
|
543
|
+
Started GET "/accounts" for 127.0.0.1 at 2013-04-03 15:09:47 -0400
|
544
|
+
Processing by AccountsController#index as HTML
|
545
|
+
[1m[36mAccount Load (0.3ms)[0m [1mSELECT `accounts`.* FROM `accounts` [0m
|
546
|
+
Rendered accounts/index.html.haml within layouts/application (1.2ms)
|
547
|
+
Completed 200 OK in 12ms (Views: 5.0ms | ActiveRecord: 0.3ms)
|
548
|
+
Connecting to database specified by database.yml
|
549
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
550
|
+
[1m[35mSQL (2.1ms)[0m INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-03 19:13:13', 'test_account', '2013-04-03 19:13:13')
|
551
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
552
|
+
Started GET "/accounts/46" for 127.0.0.1 at 2013-04-03 15:13:13 -0400
|
553
|
+
Processing by AccountsController#show as HTML
|
554
|
+
Parameters: {"id"=>"46"}
|
555
|
+
[1m[35mAccount Load (0.3ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 46 LIMIT 1
|
556
|
+
[1m[36m (0.3ms)[0m [1mSELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 46 AND `modulate_documents`.`attachable_type` = 'Account'[0m
|
557
|
+
Rendered accounts/_modulate_account_documents.html.haml (101.2ms)
|
558
|
+
Rendered accounts/_modulate_attachments.html.haml (275.5ms)
|
559
|
+
Rendered accounts/show.html.erb within layouts/application (288.9ms)
|
560
|
+
Completed 200 OK in 314ms (Views: 304.6ms | ActiveRecord: 3.1ms)
|
561
|
+
Started PUT "/accounts/46" for 127.0.0.1 at 2013-04-03 15:13:14 -0400
|
562
|
+
Processing by AccountsController#update as HTML
|
563
|
+
Parameters: {"utf8"=>"✓", "account"=>{"modulate_documents_attributes"=>[{"attachment"=>#<ActionDispatch::Http::UploadedFile:0x007fcb3c827b48 @original_filename="test.txt", @content_type="text/plain", @headers="Content-Disposition: form-data; name=\"account[modulate_documents_attributes][][attachment]\"; filename=\"test.txt\"\r\nContent-Type: text/plain\r\nContent-Length: 25\r\n", @tempfile=#<File:/var/folders/lb/j1c12jc524zfb75l84v94qr40000gn/T/RackMultipart20130403-62010-1md7zbl>>}]}, "button"=>"", "id"=>"46"}
|
564
|
+
[1m[35mAccount Load (0.3ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 46 LIMIT 1
|
565
|
+
[1m[36mModulate::Document Load (0.4ms)[0m [1mSELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 46 AND `modulate_documents`.`attachable_type` = 'Account'[0m
|
566
|
+
[1m[35m (0.1ms)[0m BEGIN
|
567
|
+
[1m[36mCACHE (0.0ms)[0m [1mSELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 46 LIMIT 1[0m
|
568
|
+
[1m[35mModulate::Document Exists (0.3ms)[0m SELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '46-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1
|
569
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO `modulate_documents` (`attachable_id`, `attachable_type`, `attached_by_id`, `attachment`, `bucket`, `content_type`, `created_at`, `filename`, `key`, `label`, `public`, `updated_at`) VALUES (46, 'Account', 1, '46-test.txt', 'Dummy::Account', 'text/plain', '2013-04-03 19:13:14', 'test.txt', '46-test.txt', NULL, 0, '2013-04-03 19:13:14')[0m
|
570
|
+
[1m[35m (0.4ms)[0m COMMIT
|
571
|
+
Redirected to http://www.example.com/accounts
|
572
|
+
Completed 302 Found in 113ms (ActiveRecord: 1.8ms)
|
573
|
+
Started GET "/accounts" for 127.0.0.1 at 2013-04-03 15:13:14 -0400
|
574
|
+
Processing by AccountsController#index as HTML
|
575
|
+
[1m[36mAccount Load (0.3ms)[0m [1mSELECT `accounts`.* FROM `accounts` [0m
|
576
|
+
Rendered accounts/index.html.haml within layouts/application (1.2ms)
|
577
|
+
Completed 200 OK in 13ms (Views: 4.8ms | ActiveRecord: 0.3ms)
|
578
|
+
Connecting to database specified by database.yml
|
579
|
+
[1m[36m (0.2ms)[0m [1mBEGIN[0m
|
580
|
+
[1m[35mSQL (2.1ms)[0m INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-03 19:13:47', 'test_account', '2013-04-03 19:13:47')
|
581
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
582
|
+
Started GET "/accounts/47" for 127.0.0.1 at 2013-04-03 15:13:47 -0400
|
583
|
+
Processing by AccountsController#show as HTML
|
584
|
+
Parameters: {"id"=>"47"}
|
585
|
+
[1m[35mAccount Load (0.3ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 47 LIMIT 1
|
586
|
+
[1m[36m (0.2ms)[0m [1mSELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 47 AND `modulate_documents`.`attachable_type` = 'Account'[0m
|
587
|
+
Rendered accounts/_modulate_account_documents.html.haml (57.6ms)
|
588
|
+
Rendered accounts/_modulate_attachments.html.haml (279.8ms)
|
589
|
+
Rendered accounts/show.html.erb within layouts/application (289.0ms)
|
590
|
+
Completed 200 OK in 366ms (Views: 357.0ms | ActiveRecord: 3.0ms)
|
591
|
+
Started PUT "/accounts/47" for 127.0.0.1 at 2013-04-03 15:13:47 -0400
|
592
|
+
Processing by AccountsController#update as HTML
|
593
|
+
Parameters: {"utf8"=>"✓", "account"=>{"modulate_documents_attributes"=>[{"attachment"=>#<ActionDispatch::Http::UploadedFile:0x007ffac6fdee68 @original_filename="test.txt", @content_type="text/plain", @headers="Content-Disposition: form-data; name=\"account[modulate_documents_attributes][][attachment]\"; filename=\"test.txt\"\r\nContent-Type: text/plain\r\nContent-Length: 25\r\n", @tempfile=#<File:/var/folders/lb/j1c12jc524zfb75l84v94qr40000gn/T/RackMultipart20130403-62040-1qr8rvz>>}]}, "button"=>"", "id"=>"47"}
|
594
|
+
[1m[35mAccount Load (0.3ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 47 LIMIT 1
|
595
|
+
[1m[36mModulate::Document Load (0.3ms)[0m [1mSELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 47 AND `modulate_documents`.`attachable_type` = 'Account'[0m
|
596
|
+
[1m[35m (0.1ms)[0m BEGIN
|
597
|
+
[1m[36mCACHE (0.0ms)[0m [1mSELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 47 LIMIT 1[0m
|
598
|
+
[1m[35mModulate::Document Exists (0.3ms)[0m SELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '47-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1
|
599
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO `modulate_documents` (`attachable_id`, `attachable_type`, `attached_by_id`, `attachment`, `bucket`, `content_type`, `created_at`, `filename`, `key`, `label`, `public`, `updated_at`) VALUES (47, 'Account', 1, '47-test.txt', 'Dummy::Account', 'text/plain', '2013-04-03 19:13:47', 'test.txt', '47-test.txt', NULL, 0, '2013-04-03 19:13:47')[0m
|
600
|
+
[1m[35m (0.4ms)[0m COMMIT
|
601
|
+
Redirected to http://www.example.com/accounts
|
602
|
+
Completed 302 Found in 113ms (ActiveRecord: 1.8ms)
|
603
|
+
Started GET "/accounts" for 127.0.0.1 at 2013-04-03 15:13:48 -0400
|
604
|
+
Processing by AccountsController#index as HTML
|
605
|
+
[1m[36mAccount Load (0.3ms)[0m [1mSELECT `accounts`.* FROM `accounts` [0m
|
606
|
+
Rendered accounts/index.html.haml within layouts/application (1.2ms)
|
607
|
+
Completed 200 OK in 13ms (Views: 4.7ms | ActiveRecord: 0.3ms)
|
608
|
+
Connecting to database specified by database.yml
|
609
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
610
|
+
[1m[35mSQL (2.3ms)[0m INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-03 19:18:28', 'test_account', '2013-04-03 19:18:28')
|
611
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
612
|
+
Started GET "/accounts/48" for 127.0.0.1 at 2013-04-03 15:18:28 -0400
|
613
|
+
Processing by AccountsController#show as HTML
|
614
|
+
Parameters: {"id"=>"48"}
|
615
|
+
[1m[35mAccount Load (0.3ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 48 LIMIT 1
|
616
|
+
[1m[36m (0.2ms)[0m [1mSELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 48 AND `modulate_documents`.`attachable_type` = 'Account'[0m
|
617
|
+
Rendered accounts/_modulate_account_documents.html.haml (57.2ms)
|
618
|
+
Rendered accounts/_modulate_attachments.html.haml (267.2ms)
|
619
|
+
Rendered accounts/show.html.erb within layouts/application (276.1ms)
|
620
|
+
Completed 200 OK in 352ms (Views: 342.5ms | ActiveRecord: 3.1ms)
|
621
|
+
Started PUT "/accounts/48" for 127.0.0.1 at 2013-04-03 15:18:29 -0400
|
622
|
+
Processing by AccountsController#update as HTML
|
623
|
+
Parameters: {"utf8"=>"✓", "account"=>{"modulate_documents_attributes"=>[{"attachment"=>#<ActionDispatch::Http::UploadedFile:0x007fd8069de668 @original_filename="test.txt", @content_type="text/plain", @headers="Content-Disposition: form-data; name=\"account[modulate_documents_attributes][][attachment]\"; filename=\"test.txt\"\r\nContent-Type: text/plain\r\nContent-Length: 25\r\n", @tempfile=#<File:/var/folders/lb/j1c12jc524zfb75l84v94qr40000gn/T/RackMultipart20130403-62146-d5dcqd>>}]}, "button"=>"", "id"=>"48"}
|
624
|
+
[1m[35mAccount Load (0.3ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 48 LIMIT 1
|
625
|
+
[1m[36mModulate::Document Load (0.3ms)[0m [1mSELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 48 AND `modulate_documents`.`attachable_type` = 'Account'[0m
|
626
|
+
[1m[35m (0.1ms)[0m BEGIN
|
627
|
+
[1m[36mCACHE (0.0ms)[0m [1mSELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 48 LIMIT 1[0m
|
628
|
+
[1m[35mModulate::Document Exists (0.3ms)[0m SELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '48-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1
|
629
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO `modulate_documents` (`attachable_id`, `attachable_type`, `attached_by_id`, `attachment`, `bucket`, `content_type`, `created_at`, `filename`, `key`, `label`, `public`, `updated_at`) VALUES (48, 'Account', 1, '48-test.txt', 'Dummy::Account', 'text/plain', '2013-04-03 19:18:29', 'test.txt', '48-test.txt', NULL, 0, '2013-04-03 19:18:29')[0m
|
630
|
+
[1m[35m (0.4ms)[0m COMMIT
|
631
|
+
Redirected to http://www.example.com/accounts
|
632
|
+
Completed 302 Found in 111ms (ActiveRecord: 1.8ms)
|
633
|
+
Started GET "/accounts" for 127.0.0.1 at 2013-04-03 15:18:29 -0400
|
634
|
+
Processing by AccountsController#index as HTML
|
635
|
+
[1m[36mAccount Load (0.3ms)[0m [1mSELECT `accounts`.* FROM `accounts` [0m
|
636
|
+
Rendered accounts/index.html.haml within layouts/application (1.2ms)
|
637
|
+
Completed 200 OK in 12ms (Views: 4.6ms | ActiveRecord: 0.3ms)
|
638
|
+
Connecting to database specified by database.yml
|
639
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
640
|
+
[1m[35mSQL (2.1ms)[0m INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-03 19:18:46', 'test_account', '2013-04-03 19:18:46')
|
641
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
642
|
+
Started GET "/accounts/49" for 127.0.0.1 at 2013-04-03 15:18:46 -0400
|
643
|
+
Processing by AccountsController#show as HTML
|
644
|
+
Parameters: {"id"=>"49"}
|
645
|
+
[1m[35mAccount Load (0.3ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 49 LIMIT 1
|
646
|
+
[1m[36m (0.2ms)[0m [1mSELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 49 AND `modulate_documents`.`attachable_type` = 'Account'[0m
|
647
|
+
Rendered accounts/_modulate_account_documents.html.haml (58.1ms)
|
648
|
+
Rendered accounts/_modulate_attachments.html.haml (271.7ms)
|
649
|
+
Rendered accounts/show.html.erb within layouts/application (280.6ms)
|
650
|
+
Completed 200 OK in 356ms (Views: 347.3ms | ActiveRecord: 3.0ms)
|
651
|
+
Started PUT "/accounts/49" for 127.0.0.1 at 2013-04-03 15:18:47 -0400
|
652
|
+
Processing by AccountsController#update as HTML
|
653
|
+
Parameters: {"utf8"=>"✓", "account"=>{"modulate_documents_attributes"=>[{"attachment"=>#<ActionDispatch::Http::UploadedFile:0x007f9133bf3738 @original_filename="test.txt", @content_type="text/plain", @headers="Content-Disposition: form-data; name=\"account[modulate_documents_attributes][][attachment]\"; filename=\"test.txt\"\r\nContent-Type: text/plain\r\nContent-Length: 25\r\n", @tempfile=#<File:/var/folders/lb/j1c12jc524zfb75l84v94qr40000gn/T/RackMultipart20130403-62174-xdn13>>}]}, "button"=>"", "id"=>"49"}
|
654
|
+
[1m[35mAccount Load (0.3ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 49 LIMIT 1
|
655
|
+
[1m[36mModulate::Document Load (0.3ms)[0m [1mSELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 49 AND `modulate_documents`.`attachable_type` = 'Account'[0m
|
656
|
+
[1m[35m (0.1ms)[0m BEGIN
|
657
|
+
[1m[36mCACHE (0.0ms)[0m [1mSELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 49 LIMIT 1[0m
|
658
|
+
[1m[35mModulate::Document Exists (0.3ms)[0m SELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '49-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1
|
659
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO `modulate_documents` (`attachable_id`, `attachable_type`, `attached_by_id`, `attachment`, `bucket`, `content_type`, `created_at`, `filename`, `key`, `label`, `public`, `updated_at`) VALUES (49, 'Account', 1, '49-test.txt', 'Dummy::Account', 'text/plain', '2013-04-03 19:18:47', 'test.txt', '49-test.txt', NULL, 0, '2013-04-03 19:18:47')[0m
|
660
|
+
[1m[35m (0.4ms)[0m COMMIT
|
661
|
+
Redirected to http://www.example.com/accounts
|
662
|
+
Completed 302 Found in 109ms (ActiveRecord: 1.7ms)
|
663
|
+
Started GET "/accounts" for 127.0.0.1 at 2013-04-03 15:18:47 -0400
|
664
|
+
Processing by AccountsController#index as HTML
|
665
|
+
[1m[36mAccount Load (0.3ms)[0m [1mSELECT `accounts`.* FROM `accounts` [0m
|
666
|
+
Rendered accounts/index.html.haml within layouts/application (1.2ms)
|
667
|
+
Completed 200 OK in 12ms (Views: 4.6ms | ActiveRecord: 0.3ms)
|
668
|
+
Connecting to database specified by database.yml
|
669
|
+
[1m[36m (0.1ms)[0m [1mBEGIN[0m
|
670
|
+
[1m[35mSQL (2.1ms)[0m INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-03 19:19:14', 'test_account', '2013-04-03 19:19:14')
|
671
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
672
|
+
Started GET "/accounts/50" for 127.0.0.1 at 2013-04-03 15:19:15 -0400
|
673
|
+
Processing by AccountsController#show as HTML
|
674
|
+
Parameters: {"id"=>"50"}
|
675
|
+
[1m[35mAccount Load (0.3ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 50 LIMIT 1
|
676
|
+
[1m[36m (0.2ms)[0m [1mSELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 50 AND `modulate_documents`.`attachable_type` = 'Account'[0m
|
677
|
+
Rendered accounts/_modulate_account_documents.html.haml (56.1ms)
|
678
|
+
Rendered accounts/_modulate_attachments.html.haml (265.4ms)
|
679
|
+
Rendered accounts/show.html.erb within layouts/application (274.3ms)
|
680
|
+
Completed 200 OK in 351ms (Views: 341.8ms | ActiveRecord: 2.9ms)
|
681
|
+
Started PUT "/accounts/50" for 127.0.0.1 at 2013-04-03 15:19:15 -0400
|
682
|
+
Processing by AccountsController#update as HTML
|
683
|
+
Parameters: {"utf8"=>"✓", "account"=>{"modulate_documents_attributes"=>[{"attachment"=>#<ActionDispatch::Http::UploadedFile:0x007f94744ed350 @original_filename="test.txt", @content_type="text/plain", @headers="Content-Disposition: form-data; name=\"account[modulate_documents_attributes][][attachment]\"; filename=\"test.txt\"\r\nContent-Type: text/plain\r\nContent-Length: 25\r\n", @tempfile=#<File:/var/folders/lb/j1c12jc524zfb75l84v94qr40000gn/T/RackMultipart20130403-62206-fquekf>>}]}, "button"=>"", "id"=>"50"}
|
684
|
+
[1m[35mAccount Load (0.3ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 50 LIMIT 1
|
685
|
+
[1m[36mModulate::Document Load (0.3ms)[0m [1mSELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 50 AND `modulate_documents`.`attachable_type` = 'Account'[0m
|
686
|
+
[1m[35m (0.1ms)[0m BEGIN
|
687
|
+
[1m[36mCACHE (0.0ms)[0m [1mSELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 50 LIMIT 1[0m
|
688
|
+
[1m[35mModulate::Document Exists (0.3ms)[0m SELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '50-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1
|
689
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO `modulate_documents` (`attachable_id`, `attachable_type`, `attached_by_id`, `attachment`, `bucket`, `content_type`, `created_at`, `filename`, `key`, `label`, `public`, `updated_at`) VALUES (50, 'Account', 1, '50-test.txt', 'Dummy::Account', 'text/plain', '2013-04-03 19:19:15', 'test.txt', '50-test.txt', NULL, 0, '2013-04-03 19:19:15')[0m
|
690
|
+
[1m[35m (0.4ms)[0m COMMIT
|
691
|
+
Redirected to http://www.example.com/accounts
|
692
|
+
Completed 302 Found in 109ms (ActiveRecord: 1.7ms)
|
693
|
+
Started GET "/accounts" for 127.0.0.1 at 2013-04-03 15:19:15 -0400
|
694
|
+
Processing by AccountsController#index as HTML
|
695
|
+
[1m[36mAccount Load (0.3ms)[0m [1mSELECT `accounts`.* FROM `accounts` [0m
|
696
|
+
Rendered accounts/index.html.haml within layouts/application (1.2ms)
|
697
|
+
Completed 200 OK in 12ms (Views: 4.6ms | ActiveRecord: 0.3ms)
|
698
|
+
Connecting to database specified by database.yml
|
699
|
+
[1m[36m (0.7ms)[0m [1mBEGIN[0m
|
700
|
+
[1m[35mSQL (2.3ms)[0m INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-03 19:19:49', 'test_account', '2013-04-03 19:19:49')
|
701
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
702
|
+
Started GET "/accounts/51" for 127.0.0.1 at 2013-04-03 15:19:50 -0400
|
703
|
+
Processing by AccountsController#show as HTML
|
704
|
+
Parameters: {"id"=>"51"}
|
705
|
+
[1m[35mAccount Load (0.3ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 51 LIMIT 1
|
706
|
+
[1m[36m (0.2ms)[0m [1mSELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 51 AND `modulate_documents`.`attachable_type` = 'Account'[0m
|
707
|
+
Rendered accounts/_modulate_account_documents.html.haml (56.2ms)
|
708
|
+
Rendered accounts/_modulate_attachments.html.haml (267.3ms)
|
709
|
+
Rendered accounts/show.html.erb within layouts/application (276.6ms)
|
710
|
+
Completed 200 OK in 352ms (Views: 342.7ms | ActiveRecord: 3.1ms)
|
711
|
+
Started PUT "/accounts/51" for 127.0.0.1 at 2013-04-03 15:19:50 -0400
|
712
|
+
Processing by AccountsController#update as HTML
|
713
|
+
Parameters: {"utf8"=>"✓", "account"=>{"modulate_documents_attributes"=>[{"attachment"=>#<ActionDispatch::Http::UploadedFile:0x007fe1b6426400 @original_filename="test.txt", @content_type="text/plain", @headers="Content-Disposition: form-data; name=\"account[modulate_documents_attributes][][attachment]\"; filename=\"test.txt\"\r\nContent-Type: text/plain\r\nContent-Length: 25\r\n", @tempfile=#<File:/var/folders/lb/j1c12jc524zfb75l84v94qr40000gn/T/RackMultipart20130403-62237-iuzcr>>}]}, "button"=>"", "id"=>"51"}
|
714
|
+
[1m[35mAccount Load (0.3ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 51 LIMIT 1
|
715
|
+
[1m[36mModulate::Document Load (0.3ms)[0m [1mSELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 51 AND `modulate_documents`.`attachable_type` = 'Account'[0m
|
716
|
+
[1m[35m (0.1ms)[0m BEGIN
|
717
|
+
[1m[36mCACHE (0.0ms)[0m [1mSELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 51 LIMIT 1[0m
|
718
|
+
[1m[35mModulate::Document Exists (0.3ms)[0m SELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '51-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1
|
719
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO `modulate_documents` (`attachable_id`, `attachable_type`, `attached_by_id`, `attachment`, `bucket`, `content_type`, `created_at`, `filename`, `key`, `label`, `public`, `updated_at`) VALUES (51, 'Account', 1, '51-test.txt', 'Dummy::Account', 'text/plain', '2013-04-03 19:19:50', 'test.txt', '51-test.txt', NULL, 0, '2013-04-03 19:19:50')[0m
|
720
|
+
[1m[35m (0.4ms)[0m COMMIT
|
721
|
+
Redirected to http://www.example.com/accounts
|
722
|
+
Completed 302 Found in 108ms (ActiveRecord: 1.8ms)
|
723
|
+
Started GET "/accounts" for 127.0.0.1 at 2013-04-03 15:19:50 -0400
|
724
|
+
Processing by AccountsController#index as HTML
|
725
|
+
[1m[36mAccount Load (0.3ms)[0m [1mSELECT `accounts`.* FROM `accounts` [0m
|
726
|
+
Rendered accounts/index.html.haml within layouts/application (1.2ms)
|
727
|
+
Completed 200 OK in 13ms (Views: 4.6ms | ActiveRecord: 0.3ms)
|
728
|
+
Connecting to database specified by database.yml
|
729
|
+
[1m[36m (0.2ms)[0m [1mBEGIN[0m
|
730
|
+
[1m[35mSQL (2.2ms)[0m INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-03 19:20:15', 'test_account', '2013-04-03 19:20:15')
|
731
|
+
[1m[36m (0.4ms)[0m [1mCOMMIT[0m
|
732
|
+
Started GET "/accounts/52" for 127.0.0.1 at 2013-04-03 15:20:16 -0400
|
733
|
+
Processing by AccountsController#show as HTML
|
734
|
+
Parameters: {"id"=>"52"}
|
735
|
+
[1m[35mAccount Load (0.3ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 52 LIMIT 1
|
736
|
+
[1m[36m (0.2ms)[0m [1mSELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 52 AND `modulate_documents`.`attachable_type` = 'Account'[0m
|
737
|
+
Rendered accounts/_modulate_account_documents.html.haml (98.2ms)
|
738
|
+
Rendered accounts/_modulate_attachments.html.haml (268.4ms)
|
739
|
+
Rendered accounts/show.html.erb within layouts/application (277.6ms)
|
740
|
+
Completed 200 OK in 302ms (Views: 292.6ms | ActiveRecord: 3.1ms)
|
741
|
+
Started PUT "/accounts/52" for 127.0.0.1 at 2013-04-03 15:20:16 -0400
|
742
|
+
Processing by AccountsController#update as HTML
|
743
|
+
Parameters: {"utf8"=>"✓", "account"=>{"modulate_documents_attributes"=>[{"attachment"=>#<ActionDispatch::Http::UploadedFile:0x007fa750d1a278 @original_filename="test.txt", @content_type="text/plain", @headers="Content-Disposition: form-data; name=\"account[modulate_documents_attributes][][attachment]\"; filename=\"test.txt\"\r\nContent-Type: text/plain\r\nContent-Length: 25\r\n", @tempfile=#<File:/var/folders/lb/j1c12jc524zfb75l84v94qr40000gn/T/RackMultipart20130403-62266-14d933f>>}]}, "button"=>"", "id"=>"52"}
|
744
|
+
[1m[35mAccount Load (0.3ms)[0m SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 52 LIMIT 1
|
745
|
+
[1m[36mModulate::Document Load (0.3ms)[0m [1mSELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 52 AND `modulate_documents`.`attachable_type` = 'Account'[0m
|
746
|
+
[1m[35m (0.1ms)[0m BEGIN
|
747
|
+
[1m[36mCACHE (0.0ms)[0m [1mSELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 52 LIMIT 1[0m
|
748
|
+
[1m[35mModulate::Document Exists (0.3ms)[0m SELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '52-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1
|
749
|
+
[1m[36mSQL (0.3ms)[0m [1mINSERT INTO `modulate_documents` (`attachable_id`, `attachable_type`, `attached_by_id`, `attachment`, `bucket`, `content_type`, `created_at`, `filename`, `key`, `label`, `public`, `updated_at`) VALUES (52, 'Account', 1, '52-test.txt', 'Dummy::Account', 'text/plain', '2013-04-03 19:20:16', 'test.txt', '52-test.txt', NULL, 0, '2013-04-03 19:20:16')[0m
|
750
|
+
[1m[35m (0.3ms)[0m COMMIT
|
751
|
+
Redirected to http://www.example.com/accounts
|
752
|
+
Completed 302 Found in 113ms (ActiveRecord: 1.6ms)
|
753
|
+
Started GET "/accounts" for 127.0.0.1 at 2013-04-03 15:20:16 -0400
|
754
|
+
Processing by AccountsController#index as HTML
|
755
|
+
[1m[36mAccount Load (0.3ms)[0m [1mSELECT `accounts`.* FROM `accounts` [0m
|
756
|
+
Rendered accounts/index.html.haml within layouts/application (1.2ms)
|
757
|
+
Completed 200 OK in 12ms (Views: 4.6ms | ActiveRecord: 0.3ms)
|
data/spec/modulate_spec.rb
CHANGED
@@ -11,12 +11,14 @@ describe Modulate do
|
|
11
11
|
end
|
12
12
|
|
13
13
|
it "adds a relationship to each model that calls it" do
|
14
|
-
Account.should_receive(:has_many).with(:
|
14
|
+
Account.should_receive(:has_many).once.with(:modulate_uploads, as: :attachable, class_name: "Modulate::Document")
|
15
|
+
Account.should_receive(:has_many).once.with(:modulate_documents, as: :attachable, class_name: "Modulate::Document")
|
15
16
|
Account.modulate
|
16
17
|
end
|
17
18
|
|
18
19
|
it "adds nested attributes to each model that calls it" do
|
19
20
|
Account.should_receive(:accepts_nested_attributes_for).with(:modulate_documents)
|
21
|
+
Account.should_receive(:accepts_nested_attributes_for).with(:modulate_uploads)
|
20
22
|
Account.modulate
|
21
23
|
end
|
22
24
|
|
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.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-04-
|
12
|
+
date: 2013-04-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: carrierwave-riak
|
@@ -166,7 +166,6 @@ files:
|
|
166
166
|
- app/controllers/modulate/documents_controller.rb
|
167
167
|
- app/models/modulate/document.rb
|
168
168
|
- app/uploaders/modulate/document_uploader.rb
|
169
|
-
- app/views/modulate/documents/show.html.haml
|
170
169
|
- config/routes.rb
|
171
170
|
- db/migrate/20130320174022_add_modulate_document_table.rb
|
172
171
|
- lib/generators/modulate/modulate_generator.rb
|
@@ -290,7 +289,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
290
289
|
version: '0'
|
291
290
|
segments:
|
292
291
|
- 0
|
293
|
-
hash:
|
292
|
+
hash: -4285118924785943183
|
294
293
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
295
294
|
none: false
|
296
295
|
requirements:
|
@@ -299,7 +298,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
299
298
|
version: '0'
|
300
299
|
segments:
|
301
300
|
- 0
|
302
|
-
hash:
|
301
|
+
hash: -4285118924785943183
|
303
302
|
requirements: []
|
304
303
|
rubyforge_project:
|
305
304
|
rubygems_version: 1.8.24
|
File without changes
|