control 0.9.0 → 0.9.1

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.
Files changed (178) hide show
  1. data/Gemfile +3 -0
  2. data/README.md +87 -0
  3. data/Rakefile +18 -0
  4. data/control.gemspec +19 -0
  5. data/db/migrate/create_transitions.rb +18 -0
  6. data/db/schema.rb +14 -0
  7. data/lib/control/errors.rb +19 -0
  8. data/lib/control/state.rb +135 -0
  9. data/lib/control/transition.rb +53 -0
  10. data/lib/control/workflow.rb +52 -0
  11. data/lib/generators/control_install/USAGE +8 -0
  12. data/lib/generators/control_install/control_install_generator.rb +22 -0
  13. data/test/lib/control/state_test.rb +80 -0
  14. data/test/lib/control/transition_test.rb +84 -0
  15. data/test/lib/control/workflow_test.rb +107 -0
  16. data/test/rails_app/Gemfile +22 -0
  17. data/test/rails_app/Gemfile.lock +130 -0
  18. data/test/rails_app/README.rdoc +261 -0
  19. data/test/rails_app/Rakefile +7 -0
  20. data/test/rails_app/app/assets/images/rails.png +0 -0
  21. data/test/rails_app/app/assets/javascripts/application.js +15 -0
  22. data/test/rails_app/app/assets/javascripts/assemblies.js.coffee +3 -0
  23. data/test/rails_app/app/assets/javascripts/boxes.js.coffee +3 -0
  24. data/test/rails_app/app/assets/javascripts/products.js.coffee +3 -0
  25. data/test/rails_app/app/assets/javascripts/rejects.js.coffee +3 -0
  26. data/test/rails_app/app/assets/javascripts/validates.js.coffee +3 -0
  27. data/test/rails_app/app/assets/stylesheets/application.css +13 -0
  28. data/test/rails_app/app/assets/stylesheets/assemblies.css.scss +3 -0
  29. data/test/rails_app/app/assets/stylesheets/boxes.css.scss +3 -0
  30. data/test/rails_app/app/assets/stylesheets/products.css.scss +8 -0
  31. data/test/rails_app/app/assets/stylesheets/rejects.css.scss +3 -0
  32. data/test/rails_app/app/assets/stylesheets/scaffolds.css.scss +56 -0
  33. data/test/rails_app/app/assets/stylesheets/validates.css.scss +3 -0
  34. data/test/rails_app/app/controllers/application_controller.rb +3 -0
  35. data/test/rails_app/app/controllers/assemblies_controller.rb +88 -0
  36. data/test/rails_app/app/controllers/boxes_controller.rb +88 -0
  37. data/test/rails_app/app/controllers/products_controller.rb +83 -0
  38. data/test/rails_app/app/controllers/rejects_controller.rb +88 -0
  39. data/test/rails_app/app/controllers/validates_controller.rb +88 -0
  40. data/test/rails_app/app/helpers/application_helper.rb +2 -0
  41. data/test/rails_app/app/helpers/assemblies_helper.rb +2 -0
  42. data/test/rails_app/app/helpers/boxes_helper.rb +2 -0
  43. data/test/rails_app/app/helpers/products_helper.rb +14 -0
  44. data/test/rails_app/app/helpers/rejects_helper.rb +2 -0
  45. data/test/rails_app/app/helpers/validates_helper.rb +2 -0
  46. data/test/rails_app/app/models/assembly.rb +6 -0
  47. data/test/rails_app/app/models/box.rb +5 -0
  48. data/test/rails_app/app/models/product.rb +8 -0
  49. data/test/rails_app/app/models/reject.rb +6 -0
  50. data/test/rails_app/app/models/validate.rb +6 -0
  51. data/test/rails_app/app/views/assemblies/_form.html.erb +24 -0
  52. data/test/rails_app/app/views/assemblies/edit.html.erb +6 -0
  53. data/test/rails_app/app/views/assemblies/index.html.erb +25 -0
  54. data/test/rails_app/app/views/assemblies/new.html.erb +5 -0
  55. data/test/rails_app/app/views/assemblies/show.html.erb +14 -0
  56. data/test/rails_app/app/views/boxes/_form.html.erb +24 -0
  57. data/test/rails_app/app/views/boxes/edit.html.erb +6 -0
  58. data/test/rails_app/app/views/boxes/index.html.erb +25 -0
  59. data/test/rails_app/app/views/boxes/new.html.erb +5 -0
  60. data/test/rails_app/app/views/boxes/show.html.erb +14 -0
  61. data/test/rails_app/app/views/layouts/application.html.erb +14 -0
  62. data/test/rails_app/app/views/products/_form.html.erb +21 -0
  63. data/test/rails_app/app/views/products/edit.html.erb +6 -0
  64. data/test/rails_app/app/views/products/index.html.erb +23 -0
  65. data/test/rails_app/app/views/products/new.html.erb +5 -0
  66. data/test/rails_app/app/views/products/show.html.erb +34 -0
  67. data/test/rails_app/app/views/rejects/_form.html.erb +20 -0
  68. data/test/rails_app/app/views/rejects/edit.html.erb +6 -0
  69. data/test/rails_app/app/views/rejects/index.html.erb +23 -0
  70. data/test/rails_app/app/views/rejects/new.html.erb +5 -0
  71. data/test/rails_app/app/views/rejects/show.html.erb +9 -0
  72. data/test/rails_app/app/views/validates/_form.html.erb +40 -0
  73. data/test/rails_app/app/views/validates/edit.html.erb +6 -0
  74. data/test/rails_app/app/views/validates/index.html.erb +33 -0
  75. data/test/rails_app/app/views/validates/new.html.erb +5 -0
  76. data/test/rails_app/app/views/validates/show.html.erb +35 -0
  77. data/test/rails_app/config.ru +4 -0
  78. data/test/rails_app/config/application.rb +59 -0
  79. data/test/rails_app/config/boot.rb +6 -0
  80. data/test/rails_app/config/database.yml +25 -0
  81. data/test/rails_app/config/environment.rb +5 -0
  82. data/test/rails_app/config/environments/development.rb +37 -0
  83. data/test/rails_app/config/environments/production.rb +67 -0
  84. data/test/rails_app/config/environments/test.rb +37 -0
  85. data/test/rails_app/config/initializers/backtrace_silencers.rb +7 -0
  86. data/test/rails_app/config/initializers/inflections.rb +15 -0
  87. data/test/rails_app/config/initializers/mime_types.rb +5 -0
  88. data/test/rails_app/config/initializers/secret_token.rb +7 -0
  89. data/test/rails_app/config/initializers/session_store.rb +8 -0
  90. data/test/rails_app/config/initializers/wrap_parameters.rb +14 -0
  91. data/test/rails_app/config/locales/en.yml +5 -0
  92. data/test/rails_app/config/routes.rb +68 -0
  93. data/test/rails_app/db/development.sqlite3 +0 -0
  94. data/test/rails_app/db/migrate/20120126165218_create_products.rb +8 -0
  95. data/test/rails_app/db/migrate/20120126165821_add_codename_to_products.rb +6 -0
  96. data/test/rails_app/db/migrate/20120126173019_create_validates.rb +14 -0
  97. data/test/rails_app/db/migrate/20120126173232_create_assemblies.rb +10 -0
  98. data/test/rails_app/db/migrate/20120126173516_create_boxes.rb +10 -0
  99. data/test/rails_app/db/migrate/20120126173539_create_rejects.rb +9 -0
  100. data/test/rails_app/db/migrate/20120126174101_create_transitions.rb +18 -0
  101. data/test/rails_app/db/schema.rb +64 -0
  102. data/test/rails_app/db/seeds.rb +7 -0
  103. data/test/rails_app/db/test.sqlite3 +0 -0
  104. data/test/rails_app/doc/README_FOR_APP +2 -0
  105. data/test/rails_app/log/development.log +8963 -0
  106. data/test/rails_app/log/test.log +321 -0
  107. data/test/rails_app/public/404.html +26 -0
  108. data/test/rails_app/public/422.html +26 -0
  109. data/test/rails_app/public/500.html +25 -0
  110. data/test/rails_app/public/favicon.ico +0 -0
  111. data/test/rails_app/public/index.html.old +241 -0
  112. data/test/rails_app/public/robots.txt +5 -0
  113. data/test/rails_app/script/rails +6 -0
  114. data/test/rails_app/test/fixtures/assemblies.yml +9 -0
  115. data/test/rails_app/test/fixtures/boxes.yml +9 -0
  116. data/test/rails_app/test/fixtures/products.yml +11 -0
  117. data/test/rails_app/test/fixtures/rejects.yml +7 -0
  118. data/test/rails_app/test/fixtures/validates.yml +17 -0
  119. data/test/rails_app/test/functional/assemblies_controller_test.rb +49 -0
  120. data/test/rails_app/test/functional/boxes_controller_test.rb +49 -0
  121. data/test/rails_app/test/functional/products_controller_test.rb +49 -0
  122. data/test/rails_app/test/functional/rejects_controller_test.rb +49 -0
  123. data/test/rails_app/test/functional/validates_controller_test.rb +49 -0
  124. data/test/rails_app/test/performance/browsing_test.rb +12 -0
  125. data/test/rails_app/test/test_helper.rb +13 -0
  126. data/test/rails_app/test/unit/assembly_test.rb +7 -0
  127. data/test/rails_app/test/unit/box_test.rb +7 -0
  128. data/test/rails_app/test/unit/helpers/assemblies_helper_test.rb +4 -0
  129. data/test/rails_app/test/unit/helpers/boxes_helper_test.rb +4 -0
  130. data/test/rails_app/test/unit/helpers/products_helper_test.rb +4 -0
  131. data/test/rails_app/test/unit/helpers/rejects_helper_test.rb +4 -0
  132. data/test/rails_app/test/unit/helpers/validates_helper_test.rb +4 -0
  133. data/test/rails_app/test/unit/product_test.rb +7 -0
  134. data/test/rails_app/test/unit/reject_test.rb +7 -0
  135. data/test/rails_app/test/unit/validate_test.rb +7 -0
  136. data/test/rails_app/tmp/cache/assets/CD7/6F0/sprockets%2Fbd3936370d0f952ada5774e2230046ed +0 -0
  137. data/test/rails_app/tmp/cache/assets/CD8/370/sprockets%2F357970feca3ac29060c1e3861e2c0953 +0 -0
  138. data/test/rails_app/tmp/cache/assets/CDF/890/sprockets%2F1380c8a9a90c9434c33ea3a2b759546f +0 -0
  139. data/test/rails_app/tmp/cache/assets/CF0/DA0/sprockets%2Fd7d5b37686831d37c4dd75e645f5e016 +0 -0
  140. data/test/rails_app/tmp/cache/assets/CF1/E50/sprockets%2F627ffd39f3642a2a236775d77839fac3 +0 -0
  141. data/test/rails_app/tmp/cache/assets/CFC/170/sprockets%2F80efc018414af123b11d0c6485e87b1b +0 -0
  142. data/test/rails_app/tmp/cache/assets/D0B/B40/sprockets%2F2eace11b521905c77d38470c975fa28a +0 -0
  143. data/test/rails_app/tmp/cache/assets/D13/8E0/sprockets%2F4476d1e237763ebe413a93e0ae559e6b +0 -0
  144. data/test/rails_app/tmp/cache/assets/D13/E20/sprockets%2F382583b312ba3d6f09b596f6bb63a98b +0 -0
  145. data/test/rails_app/tmp/cache/assets/D15/750/sprockets%2F4cc25a6e69224dc83fed65a4242479c5 +0 -0
  146. data/test/rails_app/tmp/cache/assets/D1B/3B0/sprockets%2F0098fc768cb8d9c834fcb13163c85b54 +0 -0
  147. data/test/rails_app/tmp/cache/assets/D20/C40/sprockets%2F46d84fd895a96b157269bd6b7bae2623 +0 -0
  148. data/test/rails_app/tmp/cache/assets/D32/A10/sprockets%2F13fe41fee1fe35b49d145bcc06610705 +0 -0
  149. data/test/rails_app/tmp/cache/assets/D3F/4A0/sprockets%2Fba62c891c908a4219fb4d2005f886aee +0 -0
  150. data/test/rails_app/tmp/cache/assets/D45/C10/sprockets%2F29eede3408740d29d159a8367d1abe4e +0 -0
  151. data/test/rails_app/tmp/cache/assets/D4B/EC0/sprockets%2Fb261fa987a3e88f07b352eba69495e3b +0 -0
  152. data/test/rails_app/tmp/cache/assets/D4E/1B0/sprockets%2Ff7cbd26ba1d28d48de824f0e94586655 +0 -0
  153. data/test/rails_app/tmp/cache/assets/D5A/EA0/sprockets%2Fd771ace226fc8215a3572e0aa35bb0d6 +0 -0
  154. data/test/rails_app/tmp/cache/assets/D65/620/sprockets%2Fc821c64ad244b34cd1c92ce6e4844f2a +0 -0
  155. data/test/rails_app/tmp/cache/assets/D78/F10/sprockets%2Fc81a77308c5e0c2b8efc69bece538149 +0 -0
  156. data/test/rails_app/tmp/cache/assets/D7B/040/sprockets%2F2ea981ebd7b7a34bd9d75f626f81c526 +0 -0
  157. data/test/rails_app/tmp/cache/assets/D9C/4A0/sprockets%2Fc15750bf0161f2878cf9da9bb1a84ecb +0 -0
  158. data/test/rails_app/tmp/cache/assets/DA2/120/sprockets%2Fdfd12e4fb8ce07a2d3c4856974a2f4e3 +0 -0
  159. data/test/rails_app/tmp/cache/assets/DA9/180/sprockets%2F1eca18f8334b5ce5f73e18d778bc7e3b +0 -0
  160. data/test/rails_app/tmp/cache/assets/DB4/120/sprockets%2Fc4ad185fad2acc8f1133bb2a80f400d7 +0 -0
  161. data/test/rails_app/tmp/cache/assets/DD2/B40/sprockets%2Ff8f229b2c6e61975aca38da7a1cb7b8c +0 -0
  162. data/test/rails_app/tmp/cache/assets/DD5/CF0/sprockets%2Fac6d0c5baedfe70588f57e99b0c4c722 +0 -0
  163. data/test/rails_app/tmp/cache/assets/DDC/400/sprockets%2Fcffd775d018f68ce5dba1ee0d951a994 +0 -0
  164. data/test/rails_app/tmp/cache/assets/DDD/AE0/sprockets%2F524b597ade6bc1d79c9a4ffd6e3682bd +0 -0
  165. data/test/rails_app/tmp/cache/assets/E04/890/sprockets%2F2f5173deea6c795b8fdde723bb4b63af +0 -0
  166. data/test/rails_app/tmp/cache/assets/E06/E60/sprockets%2F1afcf29a4e0c835cb47d9bf28cf8a86b +0 -0
  167. data/test/rails_app/tmp/cache/assets/E19/2A0/sprockets%2F10fcfbe6ebae11a40c8eac41939a1b9a +0 -0
  168. data/test/rails_app/tmp/cache/assets/E25/4C0/sprockets%2Fde2fd9fd11c04a582cdbbe3d84a35ae6 +0 -0
  169. data/test/rails_app/tmp/cache/assets/E35/980/sprockets%2Fa5beac77f747ffbc71d32edecf38904a +0 -0
  170. data/test/rails_app/tmp/cache/sass/0caf4829b2adaabee514492a80140305d59a00b9/assemblies.css.scssc +0 -0
  171. data/test/rails_app/tmp/cache/sass/0caf4829b2adaabee514492a80140305d59a00b9/boxes.css.scssc +0 -0
  172. data/test/rails_app/tmp/cache/sass/0caf4829b2adaabee514492a80140305d59a00b9/products.css.scssc +0 -0
  173. data/test/rails_app/tmp/cache/sass/0caf4829b2adaabee514492a80140305d59a00b9/rejects.css.scssc +0 -0
  174. data/test/rails_app/tmp/cache/sass/0caf4829b2adaabee514492a80140305d59a00b9/scaffolds.css.scssc +0 -0
  175. data/test/rails_app/tmp/cache/sass/0caf4829b2adaabee514492a80140305d59a00b9/validates.css.scssc +0 -0
  176. data/test/test_helper.rb +67 -0
  177. data/test/test_schema.rb +32 -0
  178. metadata +210 -1
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env rake
2
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
3
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
4
+
5
+ require File.expand_path('../config/application', __FILE__)
6
+
7
+ RailsApp::Application.load_tasks
@@ -0,0 +1,15 @@
1
+ // This is a manifest file that'll be compiled into application.js, which will include all the files
2
+ // listed below.
3
+ //
4
+ // Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
5
+ // or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
6
+ //
7
+ // It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
8
+ // the compiled file.
9
+ //
10
+ // WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
11
+ // GO AFTER THE REQUIRES BELOW.
12
+ //
13
+ //= require jquery
14
+ //= require jquery_ujs
15
+ //= require_tree .
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,3 @@
1
+ # Place all the behaviors and hooks related to the matching controller here.
2
+ # All this logic will automatically be available in application.js.
3
+ # You can use CoffeeScript in this file: http://jashkenas.github.com/coffee-script/
@@ -0,0 +1,13 @@
1
+ /*
2
+ * This is a manifest file that'll be compiled into application.css, which will include all the files
3
+ * listed below.
4
+ *
5
+ * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
6
+ * or vendor/assets/stylesheets of plugins, if any, can be referenced here using a relative path.
7
+ *
8
+ * You're free to add application-wide styles to this file and they'll appear at the top of the
9
+ * compiled file, but it's generally better to create a new file per style scope.
10
+ *
11
+ *= require_self
12
+ *= require_tree .
13
+ */
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the assemblies controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the boxes controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,8 @@
1
+ // Place all the styles related to the products controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
4
+
5
+ .breadcrumb ol { margin-left: 0 }
6
+ .breadcrumb li { display: inline; }
7
+ .breadcrumb li h3 { display: inline }
8
+ h2 {display: inline}
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the rejects controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,56 @@
1
+ body {
2
+ background-color: #fff;
3
+ color: #333;
4
+ font-family: verdana, arial, helvetica, sans-serif;
5
+ font-size: 13px;
6
+ line-height: 18px; }
7
+
8
+ p, ol, ul, td {
9
+ font-family: verdana, arial, helvetica, sans-serif;
10
+ font-size: 13px;
11
+ line-height: 18px; }
12
+
13
+ pre {
14
+ background-color: #eee;
15
+ padding: 10px;
16
+ font-size: 11px; }
17
+
18
+ a {
19
+ color: #000;
20
+ &:visited {
21
+ color: #666; }
22
+ &:hover {
23
+ color: #fff;
24
+ background-color: #000; } }
25
+
26
+ div {
27
+ &.field, &.actions {
28
+ margin-bottom: 10px; } }
29
+
30
+ #notice {
31
+ color: green; }
32
+
33
+ .field_with_errors {
34
+ padding: 2px;
35
+ background-color: red;
36
+ display: table; }
37
+
38
+ #error_explanation {
39
+ width: 450px;
40
+ border: 2px solid red;
41
+ padding: 7px;
42
+ padding-bottom: 0;
43
+ margin-bottom: 20px;
44
+ background-color: #f0f0f0;
45
+ h2 {
46
+ text-align: left;
47
+ font-weight: bold;
48
+ padding: 5px 5px 5px 15px;
49
+ font-size: 12px;
50
+ margin: -7px;
51
+ margin-bottom: 0px;
52
+ background-color: #c00;
53
+ color: #fff; }
54
+ ul li {
55
+ font-size: 12px;
56
+ list-style: square; } }
@@ -0,0 +1,3 @@
1
+ // Place all the styles related to the validates controller here.
2
+ // They will automatically be included in application.css.
3
+ // You can use Sass (SCSS) here: http://sass-lang.com/
@@ -0,0 +1,3 @@
1
+ class ApplicationController < ActionController::Base
2
+ protect_from_forgery
3
+ end
@@ -0,0 +1,88 @@
1
+ class AssembliesController < ApplicationController
2
+ # GET /assemblies
3
+ # GET /assemblies.json
4
+ def index
5
+ @assemblies = Assembly.all
6
+
7
+ respond_to do |format|
8
+ format.html # index.html.erb
9
+ format.json { render json: @assemblies }
10
+ end
11
+ end
12
+
13
+ # GET /assemblies/1
14
+ # GET /assemblies/1.json
15
+ def show
16
+ @assembly = Assembly.find(params[:id])
17
+
18
+ respond_to do |format|
19
+ format.html # show.html.erb
20
+ format.json { render json: @assembly }
21
+ end
22
+ end
23
+
24
+ # GET /assemblies/new
25
+ # GET /assemblies/new.json
26
+ def new
27
+ unless params[:product_id]
28
+ render :text => 'no product?'
29
+ return
30
+ end
31
+ @assembly = Assembly.new
32
+ @assembly.product_id = params[:product_id]
33
+
34
+ respond_to do |format|
35
+ format.html # new.html.erb
36
+ format.json { render json: @assembly }
37
+ end
38
+ end
39
+
40
+ # GET /assemblies/1/edit
41
+ def edit
42
+ @assembly = Assembly.find(params[:id])
43
+ end
44
+
45
+ # POST /assemblies
46
+ # POST /assemblies.json
47
+ def create
48
+ @assembly = Assembly.new(params[:assembly])
49
+
50
+ respond_to do |format|
51
+ if @assembly.save
52
+ format.html { redirect_to @assembly, notice: 'Assembly was successfully created.' }
53
+ format.json { render json: @assembly, status: :created, location: @assembly }
54
+ else
55
+ format.html { render action: "new" }
56
+ format.json { render json: @assembly.errors, status: :unprocessable_entity }
57
+ end
58
+ end
59
+ end
60
+
61
+ # PUT /assemblies/1
62
+ # PUT /assemblies/1.json
63
+ def update
64
+ @assembly = Assembly.find(params[:id])
65
+
66
+ respond_to do |format|
67
+ if @assembly.update_attributes(params[:assembly])
68
+ format.html { redirect_to @assembly, notice: 'Assembly was successfully updated.' }
69
+ format.json { head :no_content }
70
+ else
71
+ format.html { render action: "edit" }
72
+ format.json { render json: @assembly.errors, status: :unprocessable_entity }
73
+ end
74
+ end
75
+ end
76
+
77
+ # DELETE /assemblies/1
78
+ # DELETE /assemblies/1.json
79
+ def destroy
80
+ @assembly = Assembly.find(params[:id])
81
+ @assembly.destroy
82
+
83
+ respond_to do |format|
84
+ format.html { redirect_to assemblies_url }
85
+ format.json { head :no_content }
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,88 @@
1
+ class BoxesController < ApplicationController
2
+ # GET /boxes
3
+ # GET /boxes.json
4
+ def index
5
+ @boxes = Box.all
6
+
7
+ respond_to do |format|
8
+ format.html # index.html.erb
9
+ format.json { render json: @boxes }
10
+ end
11
+ end
12
+
13
+ # GET /boxes/1
14
+ # GET /boxes/1.json
15
+ def show
16
+ @box = Box.find(params[:id])
17
+
18
+ respond_to do |format|
19
+ format.html # show.html.erb
20
+ format.json { render json: @box }
21
+ end
22
+ end
23
+
24
+ # GET /boxes/new
25
+ # GET /boxes/new.json
26
+ def new
27
+ unless params[:product_id]
28
+ render :text => 'no product?'
29
+ return
30
+ end
31
+ @box = Box.new
32
+ @box.product_id = params[:product_id]
33
+
34
+ respond_to do |format|
35
+ format.html # new.html.erb
36
+ format.json { render json: @box }
37
+ end
38
+ end
39
+
40
+ # GET /boxes/1/edit
41
+ def edit
42
+ @box = Box.find(params[:id])
43
+ end
44
+
45
+ # POST /boxes
46
+ # POST /boxes.json
47
+ def create
48
+ @box = Box.new(params[:box])
49
+
50
+ respond_to do |format|
51
+ if @box.save
52
+ format.html { redirect_to @box, notice: 'Box was successfully created.' }
53
+ format.json { render json: @box, status: :created, location: @box }
54
+ else
55
+ format.html { render action: "new" }
56
+ format.json { render json: @box.errors, status: :unprocessable_entity }
57
+ end
58
+ end
59
+ end
60
+
61
+ # PUT /boxes/1
62
+ # PUT /boxes/1.json
63
+ def update
64
+ @box = Box.find(params[:id])
65
+
66
+ respond_to do |format|
67
+ if @box.update_attributes(params[:box])
68
+ format.html { redirect_to @box, notice: 'Box was successfully updated.' }
69
+ format.json { head :no_content }
70
+ else
71
+ format.html { render action: "edit" }
72
+ format.json { render json: @box.errors, status: :unprocessable_entity }
73
+ end
74
+ end
75
+ end
76
+
77
+ # DELETE /boxes/1
78
+ # DELETE /boxes/1.json
79
+ def destroy
80
+ @box = Box.find(params[:id])
81
+ @box.destroy
82
+
83
+ respond_to do |format|
84
+ format.html { redirect_to boxes_url }
85
+ format.json { head :no_content }
86
+ end
87
+ end
88
+ end
@@ -0,0 +1,83 @@
1
+ class ProductsController < ApplicationController
2
+ # GET /products
3
+ # GET /products.json
4
+ def index
5
+ @products = Product.all
6
+
7
+ respond_to do |format|
8
+ format.html # index.html.erb
9
+ format.json { render json: @products }
10
+ end
11
+ end
12
+
13
+ # GET /products/1
14
+ # GET /products/1.json
15
+ def show
16
+ @product = Product.find(params[:id])
17
+
18
+ respond_to do |format|
19
+ format.html # show.html.erb
20
+ format.json { render json: @product }
21
+ end
22
+ end
23
+
24
+ # GET /products/new
25
+ # GET /products/new.json
26
+ def new
27
+ @product = Product.new
28
+
29
+ respond_to do |format|
30
+ format.html # new.html.erb
31
+ format.json { render json: @product }
32
+ end
33
+ end
34
+
35
+ # GET /products/1/edit
36
+ def edit
37
+ @product = Product.find(params[:id])
38
+ end
39
+
40
+ # POST /products
41
+ # POST /products.json
42
+ def create
43
+ @product = Product.new(params[:product])
44
+
45
+ respond_to do |format|
46
+ if @product.save
47
+ format.html { redirect_to @product, notice: 'Product was successfully created.' }
48
+ format.json { render json: @product, status: :created, location: @product }
49
+ else
50
+ format.html { render action: "new" }
51
+ format.json { render json: @product.errors, status: :unprocessable_entity }
52
+ end
53
+ end
54
+ end
55
+
56
+ # PUT /products/1
57
+ # PUT /products/1.json
58
+ def update
59
+ @product = Product.find(params[:id])
60
+
61
+ respond_to do |format|
62
+ if @product.update_attributes(params[:product])
63
+ format.html { redirect_to @product, notice: 'Product was successfully updated.' }
64
+ format.json { head :no_content }
65
+ else
66
+ format.html { render action: "edit" }
67
+ format.json { render json: @product.errors, status: :unprocessable_entity }
68
+ end
69
+ end
70
+ end
71
+
72
+ # DELETE /products/1
73
+ # DELETE /products/1.json
74
+ def destroy
75
+ @product = Product.find(params[:id])
76
+ @product.destroy
77
+
78
+ respond_to do |format|
79
+ format.html { redirect_to products_url }
80
+ format.json { head :no_content }
81
+ end
82
+ end
83
+ end
@@ -0,0 +1,88 @@
1
+ class RejectsController < ApplicationController
2
+ # GET /rejects
3
+ # GET /rejects.json
4
+ def index
5
+ @rejects = Reject.all
6
+
7
+ respond_to do |format|
8
+ format.html # index.html.erb
9
+ format.json { render json: @rejects }
10
+ end
11
+ end
12
+
13
+ # GET /rejects/1
14
+ # GET /rejects/1.json
15
+ def show
16
+ @reject = Reject.find(params[:id])
17
+
18
+ respond_to do |format|
19
+ format.html # show.html.erb
20
+ format.json { render json: @reject }
21
+ end
22
+ end
23
+
24
+ # GET /rejects/new
25
+ # GET /rejects/new.json
26
+ def new
27
+ unless params[:product_id]
28
+ render :text => 'no product?'
29
+ return
30
+ end
31
+ @reject = Reject.new
32
+ @reject.product_id = params[:product_id]
33
+
34
+ respond_to do |format|
35
+ format.html # new.html.erb
36
+ format.json { render json: @reject }
37
+ end
38
+ end
39
+
40
+ # GET /rejects/1/edit
41
+ def edit
42
+ @reject = Reject.find(params[:id])
43
+ end
44
+
45
+ # POST /rejects
46
+ # POST /rejects.json
47
+ def create
48
+ @reject = Reject.new(params[:reject])
49
+
50
+ respond_to do |format|
51
+ if @reject.save
52
+ format.html { redirect_to @reject, notice: 'Reject was successfully created.' }
53
+ format.json { render json: @reject, status: :created, location: @reject }
54
+ else
55
+ format.html { render action: "new" }
56
+ format.json { render json: @reject.errors, status: :unprocessable_entity }
57
+ end
58
+ end
59
+ end
60
+
61
+ # PUT /rejects/1
62
+ # PUT /rejects/1.json
63
+ def update
64
+ @reject = Reject.find(params[:id])
65
+
66
+ respond_to do |format|
67
+ if @reject.update_attributes(params[:reject])
68
+ format.html { redirect_to @reject, notice: 'Reject was successfully updated.' }
69
+ format.json { head :no_content }
70
+ else
71
+ format.html { render action: "edit" }
72
+ format.json { render json: @reject.errors, status: :unprocessable_entity }
73
+ end
74
+ end
75
+ end
76
+
77
+ # DELETE /rejects/1
78
+ # DELETE /rejects/1.json
79
+ def destroy
80
+ @reject = Reject.find(params[:id])
81
+ @reject.destroy
82
+
83
+ respond_to do |format|
84
+ format.html { redirect_to rejects_url }
85
+ format.json { head :no_content }
86
+ end
87
+ end
88
+ end