uploadcare-rails 1.2.0.pre.alpha3 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (209) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +5 -16
  3. data/lib/generators/templates/uploadcare_config_template.erb +138 -0
  4. data/lib/generators/uploadcare_config_generator.rb +7 -4
  5. data/lib/uploadcare/errors/type_error.rb +7 -0
  6. data/lib/uploadcare/rails/action_view/uploadcare_include_tags.rb +48 -0
  7. data/lib/uploadcare/rails/action_view/uploadcare_uploader_tags.rb +57 -0
  8. data/lib/uploadcare/rails/active_record/mount_uploadcare_file.rb +62 -0
  9. data/lib/uploadcare/rails/active_record/mount_uploadcare_file_group.rb +58 -0
  10. data/lib/uploadcare/rails/api/rest/base.rb +14 -0
  11. data/lib/uploadcare/rails/api/rest/conversion_api.rb +42 -0
  12. data/lib/uploadcare/rails/api/rest/file_api.rb +69 -0
  13. data/lib/uploadcare/rails/api/rest/group_api.rb +48 -0
  14. data/lib/uploadcare/rails/api/rest/project_api.rb +27 -0
  15. data/lib/uploadcare/rails/api/rest/webhook_api.rb +45 -0
  16. data/lib/uploadcare/rails/api/upload/base.rb +13 -0
  17. data/lib/uploadcare/rails/api/upload/upload_api.rb +53 -0
  18. data/lib/uploadcare/rails/configuration.rb +57 -0
  19. data/lib/uploadcare/rails/engine.rb +13 -17
  20. data/lib/uploadcare/rails/jobs/delete_file_job.rb +14 -0
  21. data/lib/uploadcare/rails/jobs/store_file_job.rb +14 -0
  22. data/lib/uploadcare/rails/jobs/store_group_job.rb +14 -0
  23. data/lib/uploadcare/rails/objects/concerns/loadable.rb +46 -0
  24. data/lib/uploadcare/rails/objects/file.rb +40 -20
  25. data/lib/uploadcare/rails/objects/group.rb +51 -57
  26. data/lib/uploadcare/rails/services/files_count_extractor.rb +14 -0
  27. data/lib/uploadcare/rails/services/id_extractor.rb +15 -0
  28. data/lib/uploadcare/rails/transformations/image_transformations.rb +45 -0
  29. data/lib/uploadcare/rails/version.rb +3 -1
  30. data/lib/uploadcare/rails.rb +10 -0
  31. data/lib/uploadcare-rails.rb +27 -16
  32. data/spec/fixtures/kitten.jpeg +0 -0
  33. data/spec/fixtures/vcr_cassettes/conversion_api_convert_document.yml +62 -0
  34. data/spec/fixtures/vcr_cassettes/conversion_api_convert_document_with_error.yml +62 -0
  35. data/spec/fixtures/vcr_cassettes/conversion_api_convert_video.yml +62 -0
  36. data/spec/fixtures/vcr_cassettes/conversion_api_convert_video_with_error.yml +62 -0
  37. data/spec/fixtures/vcr_cassettes/conversion_api_get_document_conversion_status.yml +59 -0
  38. data/spec/fixtures/vcr_cassettes/conversion_api_get_video_conversion_status.yml +59 -0
  39. data/spec/fixtures/vcr_cassettes/file_api_copy_file.yml +60 -0
  40. data/spec/fixtures/vcr_cassettes/file_api_delete_file.yml +58 -0
  41. data/spec/fixtures/vcr_cassettes/file_api_delete_files.yml +58 -0
  42. data/spec/fixtures/vcr_cassettes/file_api_get_file.yml +58 -0
  43. data/spec/fixtures/vcr_cassettes/file_api_get_files.yml +61 -0
  44. data/spec/fixtures/vcr_cassettes/file_api_load_file.yml +57 -0
  45. data/spec/fixtures/vcr_cassettes/file_api_store_file.yml +58 -0
  46. data/spec/fixtures/vcr_cassettes/file_api_store_files.yml +57 -0
  47. data/spec/fixtures/vcr_cassettes/group_api_create_group.yml +57 -0
  48. data/spec/fixtures/vcr_cassettes/group_api_get_group.yml +52 -0
  49. data/spec/fixtures/vcr_cassettes/group_api_get_groups.yml +57 -0
  50. data/spec/fixtures/vcr_cassettes/group_api_store_group.yml +57 -0
  51. data/spec/fixtures/vcr_cassettes/project_api_get_project.yml +59 -0
  52. data/spec/fixtures/vcr_cassettes/upload_upload_many_files.yml +55 -0
  53. data/spec/fixtures/vcr_cassettes/upload_upload_one_file.yml +105 -0
  54. data/spec/fixtures/vcr_cassettes/upload_upload_one_file_from_cdn.yml +111 -0
  55. data/spec/fixtures/vcr_cassettes/webhook_api_create_webhook.yml +59 -0
  56. data/spec/fixtures/vcr_cassettes/webhook_api_delete_webhook.yml +57 -0
  57. data/spec/fixtures/vcr_cassettes/webhook_api_get_webhooks.yml +59 -0
  58. data/spec/fixtures/vcr_cassettes/webhook_api_update_webhook.yml +59 -0
  59. data/spec/generators/uploadcare_config_generator_spec.rb +18 -26
  60. data/spec/spec_helper.rb +17 -62
  61. data/spec/support/generators.rb +8 -5
  62. data/spec/support/vcr.rb +14 -0
  63. data/spec/uploadcare/rails/action_view/uploadcare_uploader_tags_spec.rb +40 -0
  64. data/spec/uploadcare/rails/action_view/uploadcare_widget_tags_spec.rb +46 -0
  65. data/spec/uploadcare/rails/active_record/mount_uploadcare_file_spec.rb +33 -0
  66. data/spec/uploadcare/rails/active_record/mount_uploadcare_group_spec.rb +32 -0
  67. data/spec/uploadcare/rails/api/rest/conversion_api_spec.rb +110 -0
  68. data/spec/uploadcare/rails/api/rest/file_api_spec.rb +85 -0
  69. data/spec/uploadcare/rails/api/rest/group_api_spec.rb +61 -0
  70. data/spec/uploadcare/rails/api/rest/project_api_spec.rb +33 -0
  71. data/spec/uploadcare/rails/api/rest/webhook_api_spec.rb +67 -0
  72. data/spec/uploadcare/rails/api/upload/upload_api_spec.rb +82 -0
  73. data/spec/uploadcare/rails/jobs/delete_file_job_spec.rb +15 -0
  74. data/spec/uploadcare/rails/jobs/store_file_job_spec.rb +15 -0
  75. data/spec/uploadcare/rails/jobs/store_group_job_spec.rb +15 -0
  76. data/spec/uploadcare/rails/objects/file_spec.rb +77 -0
  77. data/spec/uploadcare/rails/objects/group_spec.rb +87 -0
  78. data/spec/uploadcare/rails/services/id_extractor_spec.rb +26 -0
  79. data/spec/uploadcare/rails/transformations/image_transformations_spec.rb +120 -0
  80. data/spec/uploadcare/rails_spec.rb +7 -0
  81. metadata +129 -393
  82. data/config/initializers/uploadcare.rb +0 -26
  83. data/config/uploadcare_defaults.yml +0 -12
  84. data/lib/generators/templates/uploadcare_config_template.yml +0 -71
  85. data/lib/tasks/uploadcare_rails_tasks.rake +0 -4
  86. data/lib/uploadcare/rails/action_view/include_tags.rb +0 -47
  87. data/lib/uploadcare/rails/action_view/uploader_tags.rb +0 -76
  88. data/lib/uploadcare/rails/active_record/has_file.rb +0 -89
  89. data/lib/uploadcare/rails/active_record/has_group.rb +0 -84
  90. data/lib/uploadcare/rails/active_record/has_object.rb +0 -9
  91. data/lib/uploadcare/rails/formtastic/formtastic.rb +0 -73
  92. data/lib/uploadcare/rails/operations.rb +0 -57
  93. data/lib/uploadcare/rails/settings.rb +0 -81
  94. data/lib/uploadcare/rails/simple_form/simple_form.rb +0 -63
  95. data/spec/caching/file_caching_spec.rb +0 -26
  96. data/spec/caching/group_caching_spec.rb +0 -40
  97. data/spec/cassettes/Uploadcare_Rails_File/should_load_itself.yml +0 -263
  98. data/spec/cassettes/Uploadcare_Rails_Group/group_should_stay_loaded.yml +0 -263
  99. data/spec/cassettes/Uploadcare_Rails_Group/rails_cache_should_updates_after_load_call.yml +0 -263
  100. data/spec/cassettes/group_cahsing_file_load.yml +0 -263
  101. data/spec/cassettes/has_uploadcare_file/object_with_uploadcare_file/deletes_file_after_destroy.yml +0 -1763
  102. data/spec/cassettes/has_uploadcare_file/object_with_uploadcare_file/stores_file_after_save.yml +0 -543
  103. data/spec/cassettes/has_uploadcare_group/object_attachment/contains_files_inside.yml +0 -679
  104. data/spec/cassettes/has_uploadcare_group_save.yml +0 -705
  105. data/spec/cassettes/load_group.yml +0 -263
  106. data/spec/dummy/README.rdoc +0 -28
  107. data/spec/dummy/Rakefile +0 -6
  108. data/spec/dummy/app/assets/javascripts/application.js +0 -13
  109. data/spec/dummy/app/assets/javascripts/post_with_collections.js +0 -2
  110. data/spec/dummy/app/assets/javascripts/posts.js +0 -2
  111. data/spec/dummy/app/assets/javascripts/posts_with_collection_and_files.js +0 -2
  112. data/spec/dummy/app/assets/stylesheets/application.css +0 -13
  113. data/spec/dummy/app/assets/stylesheets/post_with_collections.css +0 -4
  114. data/spec/dummy/app/assets/stylesheets/posts.css +0 -4
  115. data/spec/dummy/app/assets/stylesheets/posts_with_collection_and_files.css +0 -4
  116. data/spec/dummy/app/assets/stylesheets/scaffold.css +0 -56
  117. data/spec/dummy/app/controllers/application_controller.rb +0 -5
  118. data/spec/dummy/app/controllers/post_with_collections_controller.rb +0 -58
  119. data/spec/dummy/app/controllers/posts_controller.rb +0 -58
  120. data/spec/dummy/app/controllers/posts_with_collection_and_files_controller.rb +0 -58
  121. data/spec/dummy/app/helpers/application_helper.rb +0 -2
  122. data/spec/dummy/app/helpers/post_with_collections_helper.rb +0 -2
  123. data/spec/dummy/app/helpers/posts_helper.rb +0 -2
  124. data/spec/dummy/app/helpers/posts_with_collection_and_files_helper.rb +0 -2
  125. data/spec/dummy/app/models/post.rb +0 -3
  126. data/spec/dummy/app/models/post_with_collection.rb +0 -3
  127. data/spec/dummy/app/models/posts_with_collection_and_file.rb +0 -4
  128. data/spec/dummy/app/views/layouts/application.html.erb +0 -16
  129. data/spec/dummy/app/views/post_with_collections/_form.html.erb +0 -25
  130. data/spec/dummy/app/views/post_with_collections/edit.html.erb +0 -6
  131. data/spec/dummy/app/views/post_with_collections/index.html.erb +0 -29
  132. data/spec/dummy/app/views/post_with_collections/new.html.erb +0 -5
  133. data/spec/dummy/app/views/post_with_collections/show.html.erb +0 -14
  134. data/spec/dummy/app/views/post_with_collections/show.json.jbuilder +0 -1
  135. data/spec/dummy/app/views/posts/_form.html.erb +0 -31
  136. data/spec/dummy/app/views/posts/edit.html.erb +0 -6
  137. data/spec/dummy/app/views/posts/index.html.erb +0 -37
  138. data/spec/dummy/app/views/posts/new.html.erb +0 -5
  139. data/spec/dummy/app/views/posts/post.json.builder +0 -1
  140. data/spec/dummy/app/views/posts/show.html.erb +0 -15
  141. data/spec/dummy/app/views/posts_with_collection_and_files/_form.html.erb +0 -27
  142. data/spec/dummy/app/views/posts_with_collection_and_files/edit.html.erb +0 -6
  143. data/spec/dummy/app/views/posts_with_collection_and_files/index.html.erb +0 -25
  144. data/spec/dummy/app/views/posts_with_collection_and_files/new.html.erb +0 -5
  145. data/spec/dummy/app/views/posts_with_collection_and_files/show.html.erb +0 -4
  146. data/spec/dummy/app/views/posts_with_collection_and_files/show.json.jbuilder +0 -1
  147. data/spec/dummy/bin/bundle +0 -3
  148. data/spec/dummy/bin/rails +0 -4
  149. data/spec/dummy/bin/rake +0 -4
  150. data/spec/dummy/config/application.rb +0 -23
  151. data/spec/dummy/config/boot.rb +0 -5
  152. data/spec/dummy/config/database.yml +0 -25
  153. data/spec/dummy/config/environment.rb +0 -5
  154. data/spec/dummy/config/environments/development.rb +0 -29
  155. data/spec/dummy/config/environments/production.rb +0 -80
  156. data/spec/dummy/config/environments/test.rb +0 -36
  157. data/spec/dummy/config/initializers/backtrace_silencers.rb +0 -7
  158. data/spec/dummy/config/initializers/filter_parameter_logging.rb +0 -4
  159. data/spec/dummy/config/initializers/formtastic.rb +0 -111
  160. data/spec/dummy/config/initializers/inflections.rb +0 -16
  161. data/spec/dummy/config/initializers/mime_types.rb +0 -5
  162. data/spec/dummy/config/initializers/secret_token.rb +0 -12
  163. data/spec/dummy/config/initializers/session_store.rb +0 -3
  164. data/spec/dummy/config/initializers/simple_form.rb +0 -167
  165. data/spec/dummy/config/initializers/wrap_parameters.rb +0 -14
  166. data/spec/dummy/config/locales/en.yml +0 -23
  167. data/spec/dummy/config/locales/simple_form.en.yml +0 -31
  168. data/spec/dummy/config/routes.rb +0 -63
  169. data/spec/dummy/config/uploadcare.yml +0 -68
  170. data/spec/dummy/config.ru +0 -4
  171. data/spec/dummy/db/migrate/20171012001801_create_tables.rb +0 -27
  172. data/spec/dummy/db/schema.rb +0 -37
  173. data/spec/dummy/db/test.sqlite3 +0 -0
  174. data/spec/dummy/lib/templates/erb/scaffold/_form.html.erb +0 -13
  175. data/spec/dummy/log/development.log +0 -0
  176. data/spec/dummy/log/test.log +0 -3276
  177. data/spec/dummy/public/404.html +0 -58
  178. data/spec/dummy/public/422.html +0 -58
  179. data/spec/dummy/public/500.html +0 -57
  180. data/spec/dummy/public/favicon.ico +0 -0
  181. data/spec/dummy/tmp/cache/293/091/https%3A%2F%2Fucarecdn.com%2F19073296-2315-4726-817b-46398b2c7431%7E2%2F +0 -0
  182. data/spec/dummy/tmp/cache/2AF/761/https%3A%2F%2Fucarecdn.com%2F595319d0-a113-459f-91bd-b29c7183467b%2F +0 -0
  183. data/spec/dummy/tmp/cache/301/D41/https%3A%2F%2Fucarecdn.com%2F81332043-fa2c-452f-936b-737d87ab2ae2%2F +0 -0
  184. data/spec/dummy/tmp/cache/30A/7C1/https%3A%2F%2Fucarecdn.com%2F39b34128-a001-46fd-9773-1b6ad46e6b9e%2F +0 -0
  185. data/spec/dummy/tmp/cache/340/A41/https%3A%2F%2Fucarecdn.com%2F090bcb5f-6d19-456c-b4a3-d753e690926f%2F +0 -0
  186. data/spec/dummy/tmp/cache/3AB/5A1/https%3A%2F%2Fucarecdn.com%2F7eb0161b-cebe-4316-946b-694de6f77ef9%2F +0 -0
  187. data/spec/dummy/tmp/cache/3FC/5C1/https%3A%2F%2Fucarecdn.com%2Fc3f0464b-ce9a-4281-8eaa-5c55783ccedf%2F +0 -0
  188. data/spec/dummy/tmp/cache/431/5C1/https%3A%2F%2Fucarecdn.com%2Fa1b1bb40-bd89-4f9c-b809-e84920f24a01%7E2%2F +0 -0
  189. data/spec/dummy/tmp/cache/44B/7A1/https%3A%2F%2Fucarecdn.com%2Fd6c785a8-9761-4602-88de-65ddb04ddc6a%7E2%2F +0 -0
  190. data/spec/dummy/tmp/cache/45B/F31/https%3A%2F%2Fucarecdn.com%2F73e3cdbc-6495-4cf2-bbd1-413e6cb70004%7E2%2F +0 -0
  191. data/spec/dummy/tmp/cache/461/AA1/https%3A%2F%2Fucarecdn.com%2Fc50e9a53-0b95-48ac-a4a9-6744052dbdab%7E2%2F +0 -0
  192. data/spec/helpers/form_helpers_has_file_spec.rb +0 -30
  193. data/spec/helpers/form_helpers_has_group_spec.rb +0 -30
  194. data/spec/helpers/form_helpers_spec.rb +0 -33
  195. data/spec/helpers/formtastic_spec.rb +0 -25
  196. data/spec/helpers/include_tags_spec.rb +0 -54
  197. data/spec/helpers/simple_form_spec.rb +0 -25
  198. data/spec/helpers/uploader_tags_spec.rb +0 -21
  199. data/spec/models/has_both_file_and_group_spec.rb +0 -43
  200. data/spec/models/has_file_spec.rb +0 -46
  201. data/spec/models/has_group_spec.rb +0 -57
  202. data/spec/objects/file_spec.rb +0 -27
  203. data/spec/objects/group_spec.rb +0 -51
  204. data/spec/operations_spec.rb +0 -28
  205. data/spec/tmp/config/uploadcare.yml +0 -71
  206. data/spec/uploadcare/rails/settings_spec.rb +0 -136
  207. data/spec/uploadcare_rails_settings_spec.rb +0 -56
  208. data/spec/view.png +0 -0
  209. data/spec/view2.jpg +0 -0
@@ -1,25 +0,0 @@
1
- <%= form_for(@post_with_collection) do |f| %>
2
- <% if @post_with_collection.errors.any? %>
3
- <div id="error_explanation">
4
- <h2><%= pluralize(@post_with_collection.errors.count, "error") %> prohibited this post_with_collection from being saved:</h2>
5
-
6
- <ul>
7
- <% @post_with_collection.errors.full_messages.each do |msg| %>
8
- <li><%= msg %></li>
9
- <% end %>
10
- </ul>
11
- </div>
12
- <% end %>
13
-
14
- <div class="field">
15
- <%= f.label :title %><br>
16
- <%= f.text_field :title %>
17
- </div>
18
- <div class="field">
19
- <%= f.label :file %><br>
20
- <%= f.uploadcare_field :file %>
21
- </div>
22
- <div class="actions">
23
- <%= f.submit %>
24
- </div>
25
- <% end %>
@@ -1,6 +0,0 @@
1
- <h1>Editing post_with_collection</h1>
2
-
3
- <%= render 'form' %>
4
-
5
- <%= link_to 'Show', @post_with_collection %> |
6
- <%= link_to 'Back', post_with_collections_path %>
@@ -1,29 +0,0 @@
1
- <h1>Listing post_with_collections</h1>
2
-
3
- <table>
4
- <thead>
5
- <tr>
6
- <th>Title</th>
7
- <th>File</th>
8
- <th></th>
9
- <th></th>
10
- <th></th>
11
- </tr>
12
- </thead>
13
-
14
- <tbody>
15
- <% @post_with_collections.each do |post_with_collection| %>
16
- <tr>
17
- <td><%= post_with_collection.title %></td>
18
- <td><%= post_with_collection.file %></td>
19
- <td><%= link_to 'Show', post_with_collection %></td>
20
- <td><%= link_to 'Edit', edit_post_with_collection_path(post_with_collection) %></td>
21
- <td><%= link_to 'Destroy', post_with_collection, method: :delete, data: { confirm: 'Are you sure?' } %></td>
22
- </tr>
23
- <% end %>
24
- </tbody>
25
- </table>
26
-
27
- <br>
28
-
29
- <%= link_to 'New Post with collection', new_post_with_collection_path %>
@@ -1,5 +0,0 @@
1
- <h1>New post_with_collection</h1>
2
-
3
- <%= render 'form' %>
4
-
5
- <%= link_to 'Back', post_with_collections_path %>
@@ -1,14 +0,0 @@
1
- <p id="notice"><%= notice %></p>
2
-
3
- <p>
4
- <strong>Title:</strong>
5
- <%= @post_with_collection.title %>
6
- </p>
7
-
8
- <p>
9
- <strong>File:</strong>
10
- <%= @post_with_collection.file %>
11
- </p>
12
-
13
- <%= link_to 'Edit', edit_post_with_collection_path(@post_with_collection) %> |
14
- <%= link_to 'Back', post_with_collections_path %>
@@ -1 +0,0 @@
1
- json.extract! @post, :id, :title, :file, :group, :created_at, :updated_at
@@ -1,31 +0,0 @@
1
- <%= form_for(@post) do |f| %>
2
- <% if @post.errors.any? %>
3
- <div id="error_explanation">
4
- <h2><%= pluralize(@post.errors.count, "error") %> prohibited this post from being saved:</h2>
5
-
6
- <ul>
7
- <% @post.errors.full_messages.each do |msg| %>
8
- <li><%= msg %></li>
9
- <% end %>
10
- </ul>
11
- </div>
12
- <% end %>
13
-
14
- <div class="field">
15
- <%= f.label :title %><br>
16
- <%= f.text_field :title %>
17
- </div>
18
- <div class="field">
19
- <%= f.label :file %><br>
20
- <%= f.uploadcare_field :file, {uploadcare: {multiple: false}, data: {multiple: true}} %>
21
- </div>
22
- <div class="actions">
23
- <%= f.submit %>
24
- </div>
25
- <% end %>
26
-
27
-
28
-
29
- <%= simple_form_for(@post) do |f| %>
30
- <%= f.input :file, as: :uploadcare_uploader, uploadcare: {multiple: true} %>
31
- <% end %>
@@ -1,6 +0,0 @@
1
- <h1>Editing post</h1>
2
-
3
- <%= render 'form' %>
4
-
5
- <%= link_to 'Show', @post %> |
6
- <%= link_to 'Back', posts_path %>
@@ -1,37 +0,0 @@
1
- <h1>Listing posts</h1>
2
-
3
- <table>
4
- <thead>
5
- <tr>
6
- <th>Title</th>
7
- <th>File</th>
8
- <th></th>
9
- <th></th>
10
- <th></th>
11
- </tr>
12
- </thead>
13
-
14
- <tbody>
15
- <% @posts.each do |post| %>
16
- <tr>
17
- <td><%= post.title %></td>
18
- <td><%= post.file %></td>
19
- <td><%= link_to 'Show', post %></td>
20
- <td><%= link_to 'Edit', edit_post_path(post) %></td>
21
- <td><%= link_to 'Destroy', post, method: :delete, data: { confirm: 'Are you sure?' } %></td>
22
- </tr>
23
- <% end %>
24
- </tbody>
25
- </table>
26
-
27
- <br>
28
-
29
- <%= link_to 'New Post', new_post_path %>
30
-
31
- <br>
32
- <p>:uploadcare_uploader_tag test</p>
33
- <%= uploadcare_uploader_tag :file %>
34
-
35
- <br>
36
- <p>:uploadcare_uploader_field test</p>
37
- <%= uploadcare_uploader_field :post, :file %>
@@ -1,5 +0,0 @@
1
- <h1>New post</h1>
2
-
3
- <%= render 'form' %>
4
-
5
- <%= link_to 'Back', posts_path %>
@@ -1 +0,0 @@
1
- json.extract! @post, :id, :title, :file, :group, :created_at, :updated_at
@@ -1,15 +0,0 @@
1
- <p id="notice"><%= notice %></p>
2
-
3
- <p>
4
- <strong>Title:</strong>
5
- <%= @post.title %>
6
- </p>
7
-
8
- <p>
9
- <strong>File:</strong>
10
- <!-- <%= @post.file.try :image, false, width: "180px" %> -->
11
- <%= image_tag(@post.file)%>
12
- </p>
13
-
14
- <%= link_to 'Edit', edit_post_path(@post) %> |
15
- <%= link_to 'Back', posts_path %>
@@ -1,27 +0,0 @@
1
- <%= form_for(@posts_with_collection_and_file) do |f| %>
2
- <% if @posts_with_collection_and_file.errors.any? %>
3
- <div id="error_explanation">
4
- <h2><%= pluralize(@posts_with_collection_and_file.errors.count, "error") %> prohibited this posts_with_collection_and_file from being saved:</h2>
5
-
6
- <ul>
7
- <% @posts_with_collection_and_file.errors.full_messages.each do |msg| %>
8
- <li><%= msg %></li>
9
- <% end %>
10
- </ul>
11
- </div>
12
- <% end %>
13
-
14
- <div class="field">
15
- <%= f.label :title %><br>
16
- <%= f.text_field :title %>
17
- </div>
18
-
19
- <div class="field">
20
- <%= f.label :file %><br>
21
- <%= f.uploadcare_field :file, {uploadcare: {multiple: false}, data: {multiple: true}} %>
22
- </div>
23
-
24
- <div class="actions">
25
- <%= f.submit %>
26
- </div>
27
- <% end %>
@@ -1,6 +0,0 @@
1
- <h1>Editing posts_with_collection_and_file</h1>
2
-
3
- <%= render 'form' %>
4
-
5
- <%= link_to 'Show', @posts_with_collection_and_file %> |
6
- <%= link_to 'Back', posts_with_collection_and_files_path %>
@@ -1,25 +0,0 @@
1
- <h1>Listing posts_with_collection_and_files</h1>
2
-
3
- <table>
4
- <thead>
5
- <tr>
6
- <th></th>
7
- <th></th>
8
- <th></th>
9
- </tr>
10
- </thead>
11
-
12
- <tbody>
13
- <% @posts_with_collection_and_files.each do |posts_with_collection_and_file| %>
14
- <tr>
15
- <td><%= link_to 'Show', posts_with_collection_and_file %></td>
16
- <td><%= link_to 'Edit', edit_posts_with_collection_and_file_path(posts_with_collection_and_file) %></td>
17
- <td><%= link_to 'Destroy', posts_with_collection_and_file, method: :delete, data: { confirm: 'Are you sure?' } %></td>
18
- </tr>
19
- <% end %>
20
- </tbody>
21
- </table>
22
-
23
- <br>
24
-
25
- <%= link_to 'New Posts with collection and file', new_posts_with_collection_and_file_path %>
@@ -1,5 +0,0 @@
1
- <h1>New posts_with_collection_and_file</h1>
2
-
3
- <%= render 'form' %>
4
-
5
- <%= link_to 'Back', posts_with_collection_and_files_path %>
@@ -1,4 +0,0 @@
1
- <p id="notice"><%= notice %></p>
2
-
3
- <%= link_to 'Edit', edit_posts_with_collection_and_file_path(@posts_with_collection_and_file) %> |
4
- <%= link_to 'Back', posts_with_collection_and_files_path %>
@@ -1 +0,0 @@
1
- json.extract! @post, :id, :title, :file, :group, :created_at, :updated_at
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env ruby
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
3
- load Gem.bin_path('bundler', 'bundle')
data/spec/dummy/bin/rails DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- APP_PATH = File.expand_path('../../config/application', __FILE__)
3
- require_relative '../config/boot'
4
- require 'rails/commands'
data/spec/dummy/bin/rake DELETED
@@ -1,4 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require_relative '../config/boot'
3
- require 'rake'
4
- Rake.application.run
@@ -1,23 +0,0 @@
1
- require File.expand_path('../boot', __FILE__)
2
-
3
- require 'rails/all'
4
-
5
- Bundler.require(*Rails.groups)
6
- require "uploadcare-rails"
7
-
8
- module Dummy
9
- class Application < Rails::Application
10
- # Settings in config/environments/* take precedence over those specified here.
11
- # Application configuration should go into files in config/initializers
12
- # -- all .rb files in that directory are automatically loaded.
13
-
14
- # Set Time.zone default to the specified zone and make Active Record auto-convert to this zone.
15
- # Run "rake -D time" for a list of tasks for finding time zone names. Default is UTC.
16
- # config.time_zone = 'Central Time (US & Canada)'
17
-
18
- # The default locale is :en and all translations from config/locales/*.rb,yml are auto loaded.
19
- # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
20
- # config.i18n.default_locale = :de
21
- end
22
- end
23
-
@@ -1,5 +0,0 @@
1
- # Set up gems listed in the Gemfile.
2
- ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
-
4
- require 'bundler/setup' if File.exists?(ENV['BUNDLE_GEMFILE'])
5
- $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -1,25 +0,0 @@
1
- # SQLite version 3.x
2
- # gem install sqlite3
3
- #
4
- # Ensure the SQLite 3 gem is defined in your Gemfile
5
- # gem 'sqlite3'
6
- development:
7
- adapter: sqlite3
8
- database: db/development.sqlite3
9
- pool: 5
10
- timeout: 5000
11
-
12
- # Warning: The database defined as "test" will be erased and
13
- # re-generated from your development database when you run "rake".
14
- # Do not set this db to the same as development or production.
15
- test:
16
- adapter: sqlite3
17
- database: db/test.sqlite3
18
- pool: 5
19
- timeout: 5000
20
-
21
- production:
22
- adapter: sqlite3
23
- database: db/production.sqlite3
24
- pool: 5
25
- timeout: 5000
@@ -1,5 +0,0 @@
1
- # Load the Rails application.
2
- require File.expand_path('../application', __FILE__)
3
-
4
- # Initialize the Rails application.
5
- Dummy::Application.initialize!
@@ -1,29 +0,0 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # In the development environment your application's code is reloaded on
5
- # every request. This slows down response time but is perfect for development
6
- # since you don't have to restart the web server when you make code changes.
7
- config.cache_classes = false
8
-
9
- # Do not eager load code on boot.
10
- config.eager_load = false
11
-
12
- # Show full error reports and disable caching.
13
- config.consider_all_requests_local = true
14
- config.action_controller.perform_caching = false
15
-
16
- # Don't care if the mailer can't send.
17
- config.action_mailer.raise_delivery_errors = false
18
-
19
- # Print deprecation notices to the Rails logger.
20
- config.active_support.deprecation = :log
21
-
22
- # Raise an error on page load if there are pending migrations
23
- config.active_record.migration_error = :page_load
24
-
25
- # Debug mode disables concatenation and preprocessing of assets.
26
- # This option may cause significant delays in view rendering with a large
27
- # number of complex assets.
28
- config.assets.debug = true
29
- end
@@ -1,80 +0,0 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # Code is not reloaded between requests.
5
- config.cache_classes = true
6
-
7
- # Eager load code on boot. This eager loads most of Rails and
8
- # your application in memory, allowing both thread web servers
9
- # and those relying on copy on write to perform better.
10
- # Rake tasks automatically ignore this option for performance.
11
- config.eager_load = true
12
-
13
- # Full error reports are disabled and caching is turned on.
14
- config.consider_all_requests_local = false
15
- config.action_controller.perform_caching = true
16
-
17
- # Enable Rack::Cache to put a simple HTTP cache in front of your application
18
- # Add `rack-cache` to your Gemfile before enabling this.
19
- # For large-scale production use, consider using a caching reverse proxy like nginx, varnish or squid.
20
- # config.action_dispatch.rack_cache = true
21
-
22
- # Disable Rails's static asset server (Apache or nginx will already do this).
23
- config.serve_static_files = false
24
-
25
- # Compress JavaScripts and CSS.
26
- config.assets.js_compressor = :uglifier
27
- # config.assets.css_compressor = :sass
28
-
29
- # Do not fallback to assets pipeline if a precompiled asset is missed.
30
- config.assets.compile = false
31
-
32
- # Generate digests for assets URLs.
33
- config.assets.digest = true
34
-
35
- # Version of your assets, change this if you want to expire all your assets.
36
- config.assets.version = '1.0'
37
-
38
- # Specifies the header that your server uses for sending files.
39
- # config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
40
- # config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
41
-
42
- # Force all access to the app over SSL, use Strict-Transport-Security, and use secure cookies.
43
- # config.force_ssl = true
44
-
45
- # Set to :debug to see everything in the log.
46
- config.log_level = :info
47
-
48
- # Prepend all log lines with the following tags.
49
- # config.log_tags = [ :subdomain, :uuid ]
50
-
51
- # Use a different logger for distributed setups.
52
- # config.logger = ActiveSupport::TaggedLogging.new(SyslogLogger.new)
53
-
54
- # Use a different cache store in production.
55
- # config.cache_store = :mem_cache_store
56
-
57
- # Enable serving of images, stylesheets, and JavaScripts from an asset server.
58
- # config.action_controller.asset_host = "http://assets.example.com"
59
-
60
- # Precompile additional assets.
61
- # application.js, application.css, and all non-JS/CSS in app/assets folder are already added.
62
- # config.assets.precompile += %w( search.js )
63
-
64
- # Ignore bad email addresses and do not raise email delivery errors.
65
- # Set this to true and configure the email server for immediate delivery to raise delivery errors.
66
- # config.action_mailer.raise_delivery_errors = false
67
-
68
- # Enable locale fallbacks for I18n (makes lookups for any locale fall back to
69
- # the I18n.default_locale when a translation can not be found).
70
- config.i18n.fallbacks = true
71
-
72
- # Send deprecation notices to registered listeners.
73
- config.active_support.deprecation = :notify
74
-
75
- # Disable automatic flushing of the log to improve performance.
76
- # config.autoflush_log = false
77
-
78
- # Use default logging formatter so that PID and timestamp are not suppressed.
79
- config.log_formatter = ::Logger::Formatter.new
80
- end
@@ -1,36 +0,0 @@
1
- Dummy::Application.configure do
2
- # Settings specified here will take precedence over those in config/application.rb.
3
-
4
- # The test environment is used exclusively to run your application's
5
- # test suite. You never need to work with it otherwise. Remember that
6
- # your test database is "scratch space" for the test suite and is wiped
7
- # and recreated between test runs. Don't rely on the data there!
8
- config.cache_classes = true
9
-
10
- # Do not eager load code on boot. This avoids loading your whole application
11
- # just for the purpose of running a single test. If you are using a tool that
12
- # preloads Rails for running tests, you may have to set it to true.
13
- config.eager_load = false
14
-
15
- # Configure static asset server for tests with Cache-Control for performance.
16
- config.serve_static_files = true
17
- config.static_cache_control = "public, max-age=3600"
18
-
19
- # Show full error reports and disable caching.
20
- config.consider_all_requests_local = true
21
- config.action_controller.perform_caching = false
22
-
23
- # Raise exceptions instead of rendering exception templates.
24
- config.action_dispatch.show_exceptions = false
25
-
26
- # Disable request forgery protection in test environment.
27
- config.action_controller.allow_forgery_protection = false
28
-
29
- # Tell Action Mailer not to deliver emails to the real world.
30
- # The :test delivery method accumulates sent emails in the
31
- # ActionMailer::Base.deliveries array.
32
- config.action_mailer.delivery_method = :test
33
-
34
- # Print deprecation notices to the stderr.
35
- config.active_support.deprecation = :stderr
36
- end
@@ -1,7 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces.
4
- # Rails.backtrace_cleaner.add_silencer { |line| line =~ /my_noisy_library/ }
5
-
6
- # You can also remove all the silencers if you're trying to debug a problem that might stem from framework code.
7
- # Rails.backtrace_cleaner.remove_silencers!
@@ -1,4 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Configure sensitive parameters which will be filtered from the log file.
4
- Rails.application.config.filter_parameters += [:password]
@@ -1,111 +0,0 @@
1
- # encoding: utf-8
2
- require "formtastic"
3
-
4
- # Set the default text field size when input is a string. Default is nil.
5
- # Formtastic::FormBuilder.default_text_field_size = 50
6
-
7
- # Set the default text area height when input is a text. Default is 20.
8
- # Formtastic::FormBuilder.default_text_area_height = 5
9
-
10
- # Set the default text area width when input is a text. Default is nil.
11
- # Formtastic::FormBuilder.default_text_area_width = 50
12
-
13
- # Should all fields be considered "required" by default?
14
- # Defaults to true.
15
- # Formtastic::FormBuilder.all_fields_required_by_default = true
16
-
17
- # Should select fields have a blank option/prompt by default?
18
- # Defaults to true.
19
- # Formtastic::FormBuilder.include_blank_for_select_by_default = true
20
-
21
- # Set the string that will be appended to the labels/fieldsets which are required
22
- # It accepts string or procs and the default is a localized version of
23
- # '<abbr title="required">*</abbr>'. In other words, if you configure formtastic.required
24
- # in your locale, it will replace the abbr title properly. But if you don't want to use
25
- # abbr tag, you can simply give a string as below
26
- # Formtastic::FormBuilder.required_string = "(required)"
27
-
28
- # Set the string that will be appended to the labels/fieldsets which are optional
29
- # Defaults to an empty string ("") and also accepts procs (see required_string above)
30
- # Formtastic::FormBuilder.optional_string = "(optional)"
31
-
32
- # Set the way inline errors will be displayed.
33
- # Defaults to :sentence, valid options are :sentence, :list, :first and :none
34
- # Formtastic::FormBuilder.inline_errors = :sentence
35
- # Formtastic uses the following classes as default for hints, inline_errors and error list
36
-
37
- # If you override the class here, please ensure to override it in your stylesheets as well
38
- # Formtastic::FormBuilder.default_hint_class = "inline-hints"
39
- # Formtastic::FormBuilder.default_inline_error_class = "inline-errors"
40
- # Formtastic::FormBuilder.default_error_list_class = "errors"
41
-
42
- # Set the method to call on label text to transform or format it for human-friendly
43
- # reading when formtastic is used without object. Defaults to :humanize.
44
- # Formtastic::FormBuilder.label_str_method = :humanize
45
-
46
- # Set the array of methods to try calling on parent objects in :select and :radio inputs
47
- # for the text inside each @<option>@ tag or alongside each radio @<input>@. The first method
48
- # that is found on the object will be used.
49
- # Defaults to ["to_label", "display_name", "full_name", "name", "title", "username", "login", "value", "to_s"]
50
- # Formtastic::FormBuilder.collection_label_methods = [
51
- # "to_label", "display_name", "full_name", "name", "title", "username", "login", "value", "to_s"]
52
-
53
- # Specifies if labels/hints for input fields automatically be looked up using I18n.
54
- # Default value: true. Overridden for specific fields by setting value to true,
55
- # i.e. :label => true, or :hint => true (or opposite depending on initialized value)
56
- # Formtastic::FormBuilder.i18n_lookups_by_default = false
57
-
58
- # Specifies if I18n lookups of the default I18n Localizer should be cached to improve performance.
59
- # Defaults to true.
60
- # Formtastic::FormBuilder.i18n_cache_lookups = false
61
-
62
- # Specifies the class to use for localization lookups. You can create your own
63
- # class and use it instead by subclassing Formtastic::Localizer (which is the default).
64
- # Formtastic::FormBuilder.i18n_localizer = MyOwnLocalizer
65
-
66
- # You can add custom inputs or override parts of Formtastic by subclassing Formtastic::FormBuilder and
67
- # specifying that class here. Defaults to Formtastic::FormBuilder.
68
- # Formtastic::Helpers::FormHelper.builder = MyCustomBuilder
69
-
70
- # All formtastic forms have a class that indicates that they are just that. You
71
- # can change it to any class you want.
72
- # Formtastic::Helpers::FormHelper.default_form_class = 'formtastic'
73
-
74
- # Formtastic will infer a class name from the model, array, string ot symbol you pass to the
75
- # form builder. You can customize the way that class is presented by overriding
76
- # this proc.
77
- # Formtastic::Helpers::FormHelper.default_form_model_class_proc = proc { |model_class_name| model_class_name }
78
-
79
- # Allows to set a custom field_error_proc wrapper. By default this wrapper
80
- # is disabled since `formtastic` already adds an error class to the LI tag
81
- # containing the input.
82
- # Formtastic::Helpers::FormHelper.formtastic_field_error_proc = proc { |html_tag, instance_tag| html_tag }
83
-
84
- # You can opt-in to Formtastic's use of the HTML5 `required` attribute on `<input>`, `<select>`
85
- # and `<textarea>` tags by setting this to true (defaults to false).
86
- # Formtastic::FormBuilder.use_required_attribute = false
87
-
88
- # You can opt-in to new HTML5 browser validations (for things like email and url inputs) by setting
89
- # this to true. Doing so will add a `novalidate` attribute to the `<form>` tag.
90
- # See http://diveintohtml5.org/forms.html#validation for more info.
91
- # Formtastic::FormBuilder.perform_browser_validations = true
92
-
93
- # By creating custom input class finder, you can change how input classes are looked up.
94
- # For example you can make it to search for TextInputFilter instead of TextInput.
95
- # See # TODO: add link # for more information
96
- # NOTE: this behavior will be default from Formtastic 4.0
97
- Formtastic::FormBuilder.input_class_finder = Formtastic::InputClassFinder
98
-
99
- # Define custom namespaces in which to look up your Input classes. Default is
100
- # to look up in the global scope and in Formtastic::Inputs.
101
- # Formtastic::FormBuilder.input_namespaces = [ ::Object, ::MyInputsModule, ::Formtastic::Inputs ]
102
-
103
- # By creating custom action class finder, you can change how action classes are looked up.
104
- # For example you can make it to search for MyButtonAction instead of ButtonAction.
105
- # See # TODO: add link # for more information
106
- # NOTE: this behavior will be default from Formtastic 4.0
107
- Formtastic::FormBuilder.action_class_finder = Formtastic::ActionClassFinder
108
-
109
- # Define custom namespaces in which to look up your Action classes. Default is
110
- # to look up in the global scope and in Formtastic::Actions.
111
- # Formtastic::FormBuilder.action_namespaces = [ ::Object, ::MyActionsModule, ::Formtastic::Actions ]
@@ -1,16 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new inflection rules using the following format. Inflections
4
- # are locale specific, and you may define rules for as many different
5
- # locales as you wish. All of these examples are active by default:
6
- # ActiveSupport::Inflector.inflections(:en) do |inflect|
7
- # inflect.plural /^(ox)$/i, '\1en'
8
- # inflect.singular /^(ox)en/i, '\1'
9
- # inflect.irregular 'person', 'people'
10
- # inflect.uncountable %w( fish sheep )
11
- # end
12
-
13
- # These inflection rules are supported but not enabled by default:
14
- # ActiveSupport::Inflector.inflections(:en) do |inflect|
15
- # inflect.acronym 'RESTful'
16
- # end
@@ -1,5 +0,0 @@
1
- # Be sure to restart your server when you modify this file.
2
-
3
- # Add new mime types for use in respond_to blocks:
4
- # Mime::Type.register "text/richtext", :rtf
5
- # Mime::Type.register_alias "text/html", :iphone