modulate 0.0.7 → 0.0.8

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.
@@ -1,10 +1,10 @@
1
- = semantic_form_for @<%= model_name.underscore %> do |f|
2
- = render "modulate_<%= model_name.underscore %>_documents", f: f
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 :modulate_documents, @<%= model_name.underscore %>.modulate_documents.build do |d|
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: "<%= model_name %>[modulate_documents_attributes][][attachment]"}).sub('[attachment][]', '[attachment]').html_safe
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 @<%= model_name.underscore %>.modulate_documents.any?
13
- - @<%= model_name.underscore %>.modulate_documents.each do |document|
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
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Modulate
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -515,3 +515,243 @@ Processing by AccountsController#index as HTML
515
515
  Account Load (0.4ms) SELECT `accounts`.* FROM `accounts` 
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
+  (0.1ms) BEGIN
520
+ SQL (2.5ms) INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-03 19:09:46', 'test_account', '2013-04-03 19:09:46')
521
+  (0.4ms) COMMIT
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
+ Account Load (0.4ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 45 LIMIT 1
526
+  (0.3ms) SELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 45 AND `modulate_documents`.`attachable_type` = 'Account'
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
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 45 LIMIT 1
535
+ Modulate::Document Load (0.3ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 45 AND `modulate_documents`.`attachable_type` = 'Account'
536
+  (0.1ms) BEGIN
537
+ CACHE (0.0ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 45 LIMIT 1
538
+ Modulate::Document Exists (0.4ms) SELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '45-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1
539
+ 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 (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')
540
+  (0.4ms) 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
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` 
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
+  (0.1ms) BEGIN
550
+ SQL (2.1ms) INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-03 19:13:13', 'test_account', '2013-04-03 19:13:13')
551
+  (0.4ms) COMMIT
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
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 46 LIMIT 1
556
+  (0.3ms) SELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 46 AND `modulate_documents`.`attachable_type` = 'Account'
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
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 46 LIMIT 1
565
+ Modulate::Document Load (0.4ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 46 AND `modulate_documents`.`attachable_type` = 'Account'
566
+  (0.1ms) BEGIN
567
+ CACHE (0.0ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 46 LIMIT 1
568
+ Modulate::Document Exists (0.3ms) SELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '46-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1
569
+ 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 (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')
570
+  (0.4ms) 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
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` 
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
+  (0.2ms) BEGIN
580
+ SQL (2.1ms) INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-03 19:13:47', 'test_account', '2013-04-03 19:13:47')
581
+  (0.4ms) COMMIT
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
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 47 LIMIT 1
586
+  (0.2ms) SELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 47 AND `modulate_documents`.`attachable_type` = 'Account'
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
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 47 LIMIT 1
595
+ Modulate::Document Load (0.3ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 47 AND `modulate_documents`.`attachable_type` = 'Account'
596
+  (0.1ms) BEGIN
597
+ CACHE (0.0ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 47 LIMIT 1
598
+ Modulate::Document Exists (0.3ms) SELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '47-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1
599
+ 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 (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')
600
+  (0.4ms) 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
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` 
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
+  (0.1ms) BEGIN
610
+ SQL (2.3ms) INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-03 19:18:28', 'test_account', '2013-04-03 19:18:28')
611
+  (0.4ms) COMMIT
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
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 48 LIMIT 1
616
+  (0.2ms) SELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 48 AND `modulate_documents`.`attachable_type` = 'Account'
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
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 48 LIMIT 1
625
+ Modulate::Document Load (0.3ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 48 AND `modulate_documents`.`attachable_type` = 'Account'
626
+  (0.1ms) BEGIN
627
+ CACHE (0.0ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 48 LIMIT 1
628
+ Modulate::Document Exists (0.3ms) SELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '48-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1
629
+ 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 (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')
630
+  (0.4ms) 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
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` 
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
+  (0.1ms) BEGIN
640
+ SQL (2.1ms) INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-03 19:18:46', 'test_account', '2013-04-03 19:18:46')
641
+  (0.4ms) COMMIT
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
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 49 LIMIT 1
646
+  (0.2ms) SELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 49 AND `modulate_documents`.`attachable_type` = 'Account'
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
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 49 LIMIT 1
655
+ Modulate::Document Load (0.3ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 49 AND `modulate_documents`.`attachable_type` = 'Account'
656
+  (0.1ms) BEGIN
657
+ CACHE (0.0ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 49 LIMIT 1
658
+ Modulate::Document Exists (0.3ms) SELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '49-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1
659
+ 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 (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')
660
+  (0.4ms) 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
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` 
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
+  (0.1ms) BEGIN
670
+ SQL (2.1ms) INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-03 19:19:14', 'test_account', '2013-04-03 19:19:14')
671
+  (0.4ms) COMMIT
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
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 50 LIMIT 1
676
+  (0.2ms) SELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 50 AND `modulate_documents`.`attachable_type` = 'Account'
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
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 50 LIMIT 1
685
+ Modulate::Document Load (0.3ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 50 AND `modulate_documents`.`attachable_type` = 'Account'
686
+  (0.1ms) BEGIN
687
+ CACHE (0.0ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 50 LIMIT 1
688
+ Modulate::Document Exists (0.3ms) SELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '50-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1
689
+ 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 (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')
690
+  (0.4ms) 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
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` 
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
+  (0.7ms) BEGIN
700
+ SQL (2.3ms) INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-03 19:19:49', 'test_account', '2013-04-03 19:19:49')
701
+  (0.4ms) COMMIT
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
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 51 LIMIT 1
706
+  (0.2ms) SELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 51 AND `modulate_documents`.`attachable_type` = 'Account'
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
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 51 LIMIT 1
715
+ Modulate::Document Load (0.3ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 51 AND `modulate_documents`.`attachable_type` = 'Account'
716
+  (0.1ms) BEGIN
717
+ CACHE (0.0ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 51 LIMIT 1
718
+ Modulate::Document Exists (0.3ms) SELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '51-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1
719
+ 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 (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')
720
+  (0.4ms) 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
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` 
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
+  (0.2ms) BEGIN
730
+ SQL (2.2ms) INSERT INTO `accounts` (`created_at`, `name`, `updated_at`) VALUES ('2013-04-03 19:20:15', 'test_account', '2013-04-03 19:20:15')
731
+  (0.4ms) COMMIT
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
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 52 LIMIT 1
736
+  (0.2ms) SELECT COUNT(*) FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 52 AND `modulate_documents`.`attachable_type` = 'Account'
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
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 52 LIMIT 1
745
+ Modulate::Document Load (0.3ms) SELECT `modulate_documents`.* FROM `modulate_documents` WHERE `modulate_documents`.`attachable_id` = 52 AND `modulate_documents`.`attachable_type` = 'Account'
746
+  (0.1ms) BEGIN
747
+ CACHE (0.0ms) SELECT `accounts`.* FROM `accounts` WHERE `accounts`.`id` = 52 LIMIT 1
748
+ Modulate::Document Exists (0.3ms) SELECT 1 AS one FROM `modulate_documents` WHERE (`modulate_documents`.`key` = BINARY '52-test.txt' AND `modulate_documents`.`bucket` = 'Dummy::Account') LIMIT 1
749
+ 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 (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')
750
+  (0.3ms) 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
+ Account Load (0.3ms) SELECT `accounts`.* FROM `accounts` 
756
+ Rendered accounts/index.html.haml within layouts/application (1.2ms)
757
+ Completed 200 OK in 12ms (Views: 4.6ms | ActiveRecord: 0.3ms)
@@ -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(:modulate_documents, as: :attachable, class_name: "Modulate::Document")
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.7
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-01 00:00:00.000000000 Z
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: 3555518139713941680
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: 3555518139713941680
301
+ hash: -4285118924785943183
303
302
  requirements: []
304
303
  rubyforge_project:
305
304
  rubygems_version: 1.8.24
File without changes