user_stamp 0.0.2

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 (90) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +65 -0
  4. data/Rakefile +40 -0
  5. data/config/routes.rb +28 -0
  6. data/lib/generators/user_stamp/USAGE +9 -0
  7. data/lib/generators/user_stamp/templates/user_stamp.template +26 -0
  8. data/lib/generators/user_stamp/user_stamp_generator.rb +34 -0
  9. data/lib/tasks/user_stamp_tasks.rake +4 -0
  10. data/lib/user_stamp.rb +36 -0
  11. data/lib/user_stamp/app_controller.rb +40 -0
  12. data/lib/user_stamp/config.rb +60 -0
  13. data/lib/user_stamp/engine.rb +37 -0
  14. data/lib/user_stamp/user.rb +41 -0
  15. data/lib/user_stamp/user_stamp.rb +62 -0
  16. data/lib/user_stamp/version.rb +29 -0
  17. data/test/dummy/README.rdoc +261 -0
  18. data/test/dummy/Rakefile +7 -0
  19. data/test/dummy/app/assets/javascripts/application.js +15 -0
  20. data/test/dummy/app/assets/javascripts/materials.js +2 -0
  21. data/test/dummy/app/assets/javascripts/products.js +2 -0
  22. data/test/dummy/app/assets/stylesheets/application.css +13 -0
  23. data/test/dummy/app/assets/stylesheets/materials.css +4 -0
  24. data/test/dummy/app/assets/stylesheets/products.css +4 -0
  25. data/test/dummy/app/controllers/application_controller.rb +33 -0
  26. data/test/dummy/app/controllers/materials_controller.rb +83 -0
  27. data/test/dummy/app/controllers/products_controller.rb +83 -0
  28. data/test/dummy/app/helpers/application_helper.rb +28 -0
  29. data/test/dummy/app/helpers/materials_helper.rb +28 -0
  30. data/test/dummy/app/helpers/products_helper.rb +28 -0
  31. data/test/dummy/app/models/material.rb +43 -0
  32. data/test/dummy/app/models/product.rb +40 -0
  33. data/test/dummy/app/models/user.rb +36 -0
  34. data/test/dummy/app/views/layouts/application.html.erb +14 -0
  35. data/test/dummy/app/views/materials/_form.html.erb +33 -0
  36. data/test/dummy/app/views/materials/edit.html.erb +6 -0
  37. data/test/dummy/app/views/materials/index.html.erb +29 -0
  38. data/test/dummy/app/views/materials/new.html.erb +6 -0
  39. data/test/dummy/app/views/materials/show.html.erb +28 -0
  40. data/test/dummy/app/views/products/_form.html.erb +33 -0
  41. data/test/dummy/app/views/products/edit.html.erb +6 -0
  42. data/test/dummy/app/views/products/index.html.erb +29 -0
  43. data/test/dummy/app/views/products/new.html.erb +5 -0
  44. data/test/dummy/app/views/products/show.html.erb +25 -0
  45. data/test/dummy/config.ru +4 -0
  46. data/test/dummy/config/application.rb +59 -0
  47. data/test/dummy/config/boot.rb +10 -0
  48. data/test/dummy/config/database.yml +25 -0
  49. data/test/dummy/config/environment.rb +5 -0
  50. data/test/dummy/config/environments/development.rb +37 -0
  51. data/test/dummy/config/environments/production.rb +67 -0
  52. data/test/dummy/config/environments/test.rb +37 -0
  53. data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
  54. data/test/dummy/config/initializers/devise.rb +259 -0
  55. data/test/dummy/config/initializers/inflections.rb +15 -0
  56. data/test/dummy/config/initializers/mime_types.rb +5 -0
  57. data/test/dummy/config/initializers/secret_token.rb +7 -0
  58. data/test/dummy/config/initializers/session_store.rb +8 -0
  59. data/test/dummy/config/initializers/user_stamp.rb +26 -0
  60. data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
  61. data/test/dummy/config/locales/devise.en.yml +60 -0
  62. data/test/dummy/config/locales/en.yml +5 -0
  63. data/test/dummy/config/routes.rb +7 -0
  64. data/test/dummy/db/development.sqlite3 +0 -0
  65. data/test/dummy/db/migrate/20150418012302_devise_create_users.rb +43 -0
  66. data/test/dummy/db/migrate/20150418013334_create_products.rb +13 -0
  67. data/test/dummy/db/migrate/20150420023321_create_materials.rb +13 -0
  68. data/test/dummy/db/schema.rb +55 -0
  69. data/test/dummy/db/test.sqlite3 +0 -0
  70. data/test/dummy/log/development.log +168 -0
  71. data/test/dummy/log/test.log +5481 -0
  72. data/test/dummy/public/404.html +26 -0
  73. data/test/dummy/public/422.html +26 -0
  74. data/test/dummy/public/500.html +25 -0
  75. data/test/dummy/public/favicon.ico +0 -0
  76. data/test/dummy/script/rails +6 -0
  77. data/test/dummy/test/functional/materials_controller_test.rb +98 -0
  78. data/test/dummy/test/functional/products_controller_test.rb +99 -0
  79. data/test/dummy/test/unit/helpers/materials_helper_test.rb +30 -0
  80. data/test/dummy/test/unit/helpers/products_helper_test.rb +30 -0
  81. data/test/dummy/test/unit/material_test.rb +33 -0
  82. data/test/dummy/test/unit/product_test.rb +33 -0
  83. data/test/dummy/test/unit/user_test.rb +33 -0
  84. data/test/fixtures/materials.yml +51 -0
  85. data/test/fixtures/products.yml +51 -0
  86. data/test/fixtures/users.yml +40 -0
  87. data/test/integration/navigation_test.rb +10 -0
  88. data/test/test_helper.rb +45 -0
  89. data/test/user_stamp_test.rb +33 -0
  90. metadata +248 -0
@@ -0,0 +1,83 @@
1
+ # This file is part of the UserStamp library that provides tools to
2
+ # track who created, updated, or destroyed a record in the database.
3
+ #
4
+ # https://github.com/mjpete3/user_stamp
5
+ #
6
+ # Copyright (C) 2015 PD Technology Solutions, LLC
7
+ #
8
+ # Permission is hereby granted, free of charge, to any person obtaining
9
+ # a copy of this software and associated documentation files (the
10
+ # "Software"), to deal in the Software without restriction, including
11
+ # without limitation the rights to use, copy, modify, merge, publish,
12
+ # distribute, sublicense, and/or sell copies of the Software, and to
13
+ # permit persons to whom the Software is furnished to do so, subject to
14
+ # the following conditions:
15
+ #
16
+ # The above copyright notice and this permission notice shall be
17
+ # included in all copies or substantial portions of the Software.
18
+ #
19
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
+
27
+ class MaterialsController < ApplicationController
28
+ before_filter :authenticate_user!
29
+ before_filter :set_material, only: [:show, :edit, :update, :destroy]
30
+
31
+ def index
32
+ @materials = Material.all
33
+
34
+ respond_to do |format|
35
+ format.html
36
+ end
37
+ end
38
+
39
+ def show
40
+ respond_to do |format|
41
+ format.html
42
+ end
43
+ end
44
+
45
+ def new
46
+ @material = Material.new
47
+ respond_to do |format|
48
+ format.html
49
+ end
50
+ end
51
+
52
+ def edit
53
+ end
54
+
55
+ def create
56
+ @material = Material.new(params[:material])
57
+ @material.save
58
+
59
+ respond_to do |format|
60
+ format.html { redirect_to material_path(@material) }
61
+ end
62
+ end
63
+
64
+ def update
65
+ @material.update_attributes(params[:material])
66
+ respond_to do |format|
67
+ format.html { redirect_to material_path(@material) }
68
+ end
69
+ end
70
+
71
+ def destroy
72
+ @material.destroy
73
+
74
+ respond_to do |format|
75
+ format.html { redirect_to materials_path }
76
+ end
77
+ end
78
+
79
+ private
80
+ def set_material
81
+ @material = Material.find(params[:id])
82
+ end
83
+ end
@@ -0,0 +1,83 @@
1
+ # This file is part of the UserStamp library that provides tools to
2
+ # track who created, updated, or destroyed a record in the database.
3
+ #
4
+ # https://github.com/mjpete3/user_stamp
5
+ #
6
+ # Copyright (C) 2015 PD Technology Solutions, LLC
7
+ #
8
+ # Permission is hereby granted, free of charge, to any person obtaining
9
+ # a copy of this software and associated documentation files (the
10
+ # "Software"), to deal in the Software without restriction, including
11
+ # without limitation the rights to use, copy, modify, merge, publish,
12
+ # distribute, sublicense, and/or sell copies of the Software, and to
13
+ # permit persons to whom the Software is furnished to do so, subject to
14
+ # the following conditions:
15
+ #
16
+ # The above copyright notice and this permission notice shall be
17
+ # included in all copies or substantial portions of the Software.
18
+ #
19
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
+
27
+ class ProductsController < ApplicationController
28
+ before_filter :authenticate_user!
29
+ before_filter :set_product, only: [:show, :edit, :update, :destroy]
30
+
31
+ def index
32
+ @products = Product.all
33
+
34
+ respond_to do |format|
35
+ format.html
36
+ end
37
+ end
38
+
39
+ def show
40
+ respond_to do |format|
41
+ format.html
42
+ end
43
+ end
44
+
45
+ def new
46
+ @product = Product.new
47
+ respond_to do |format|
48
+ format.html
49
+ end
50
+ end
51
+
52
+ def edit
53
+ end
54
+
55
+ def create
56
+ @product = Product.new(params[:product])
57
+ @product.save
58
+
59
+ respond_to do |format|
60
+ format.html { redirect_to product_path(@product) }
61
+ end
62
+ end
63
+
64
+ def update
65
+ @product.update_attributes(params[:product])
66
+ respond_to do |format|
67
+ format.html { redirect_to product_path(@product) }
68
+ end
69
+ end
70
+
71
+ def destroy
72
+ @product.destroy
73
+
74
+ respond_to do |format|
75
+ format.html { redirect_to products_path }
76
+ end
77
+ end
78
+
79
+ private
80
+ def set_product
81
+ @product = Product.find(params[:id])
82
+ end
83
+ end
@@ -0,0 +1,28 @@
1
+ # This file is part of the UserStamp library that provides tools to
2
+ # track who created, updated, or destroyed a record in the database.
3
+ #
4
+ # https://github.com/mjpete3/user_stamp
5
+ #
6
+ # Copyright (C) 2015 PD Technology Solutions, LLC
7
+ #
8
+ # Permission is hereby granted, free of charge, to any person obtaining
9
+ # a copy of this software and associated documentation files (the
10
+ # "Software"), to deal in the Software without restriction, including
11
+ # without limitation the rights to use, copy, modify, merge, publish,
12
+ # distribute, sublicense, and/or sell copies of the Software, and to
13
+ # permit persons to whom the Software is furnished to do so, subject to
14
+ # the following conditions:
15
+ #
16
+ # The above copyright notice and this permission notice shall be
17
+ # included in all copies or substantial portions of the Software.
18
+ #
19
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
+
27
+ module ApplicationHelper
28
+ end
@@ -0,0 +1,28 @@
1
+ # This file is part of the UserStamp library that provides tools to
2
+ # track who created, updated, or destroyed a record in the database.
3
+ #
4
+ # https://github.com/mjpete3/user_stamp
5
+ #
6
+ # Copyright (C) 2015 PD Technology Solutions, LLC
7
+ #
8
+ # Permission is hereby granted, free of charge, to any person obtaining
9
+ # a copy of this software and associated documentation files (the
10
+ # "Software"), to deal in the Software without restriction, including
11
+ # without limitation the rights to use, copy, modify, merge, publish,
12
+ # distribute, sublicense, and/or sell copies of the Software, and to
13
+ # permit persons to whom the Software is furnished to do so, subject to
14
+ # the following conditions:
15
+ #
16
+ # The above copyright notice and this permission notice shall be
17
+ # included in all copies or substantial portions of the Software.
18
+ #
19
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
+
27
+ module MaterialsHelper
28
+ end
@@ -0,0 +1,28 @@
1
+ # This file is part of the UserStamp library that provides tools to
2
+ # track who created, updated, or destroyed a record in the database.
3
+ #
4
+ # https://github.com/mjpete3/user_stamp
5
+ #
6
+ # Copyright (C) 2015 PD Technology Solutions, LLC
7
+ #
8
+ # Permission is hereby granted, free of charge, to any person obtaining
9
+ # a copy of this software and associated documentation files (the
10
+ # "Software"), to deal in the Software without restriction, including
11
+ # without limitation the rights to use, copy, modify, merge, publish,
12
+ # distribute, sublicense, and/or sell copies of the Software, and to
13
+ # permit persons to whom the Software is furnished to do so, subject to
14
+ # the following conditions:
15
+ #
16
+ # The above copyright notice and this permission notice shall be
17
+ # included in all copies or substantial portions of the Software.
18
+ #
19
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
+
27
+ module ProductsHelper
28
+ end
@@ -0,0 +1,43 @@
1
+ # This file is part of the UserStamp library that provides tools to
2
+ # track who created, updated, or destroyed a record in the database.
3
+ #
4
+ # https://github.com/mjpete3/user_stamp
5
+ #
6
+ # Copyright (C) 2015 PD Technology Solutions, LLC
7
+ #
8
+ # Permission is hereby granted, free of charge, to any person obtaining
9
+ # a copy of this software and associated documentation files (the
10
+ # "Software"), to deal in the Software without restriction, including
11
+ # without limitation the rights to use, copy, modify, merge, publish,
12
+ # distribute, sublicense, and/or sell copies of the Software, and to
13
+ # permit persons to whom the Software is furnished to do so, subject to
14
+ # the following conditions:
15
+ #
16
+ # The above copyright notice and this permission notice shall be
17
+ # included in all copies or substantial portions of the Software.
18
+ #
19
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
+
27
+
28
+ # the created_user, updated_user and destroy_user is integer for capturing id fields.
29
+ class Material < ActiveRecord::Base
30
+ include UserStamp
31
+
32
+ attr_accessible :created_user, :deleted, :destroy_user, :name, :updated_user
33
+
34
+ scope :not_deleted, where(deleted: false)
35
+
36
+ # override the destory method to set the deleted boolean to true.
37
+ def destroy
38
+ run_callbacks :destroy do
39
+ self.update_column(:deleted, true)
40
+ end
41
+ end
42
+
43
+ end
@@ -0,0 +1,40 @@
1
+ # This file is part of the UserStamp library that provides tools to
2
+ # track who created, updated, or destroyed a record in the database.
3
+ #
4
+ # https://github.com/mjpete3/user_stamp
5
+ #
6
+ # Copyright (C) 2015 PD Technology Solutions, LLC
7
+ #
8
+ # Permission is hereby granted, free of charge, to any person obtaining
9
+ # a copy of this software and associated documentation files (the
10
+ # "Software"), to deal in the Software without restriction, including
11
+ # without limitation the rights to use, copy, modify, merge, publish,
12
+ # distribute, sublicense, and/or sell copies of the Software, and to
13
+ # permit persons to whom the Software is furnished to do so, subject to
14
+ # the following conditions:
15
+ #
16
+ # The above copyright notice and this permission notice shall be
17
+ # included in all copies or substantial portions of the Software.
18
+ #
19
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
+
27
+ class Product < ActiveRecord::Base
28
+ include UserStamp
29
+
30
+ attr_accessible :created_user, :destroy_user, :name, :updated_user, :deleted
31
+
32
+ scope :not_deleted, where(deleted: false)
33
+
34
+ # override the destory method to set the deleted boolean to true.
35
+ def destroy
36
+ run_callbacks :destroy do
37
+ self.update_column(:deleted, true)
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,36 @@
1
+ # This file is part of the UserStamp library that provides tools to
2
+ # track who created, updated, or destroyed a record in the database.
3
+ #
4
+ # https://github.com/mjpete3/user_stamp
5
+ #
6
+ # Copyright (C) 2015 PD Technology Solutions, LLC
7
+ #
8
+ # Permission is hereby granted, free of charge, to any person obtaining
9
+ # a copy of this software and associated documentation files (the
10
+ # "Software"), to deal in the Software without restriction, including
11
+ # without limitation the rights to use, copy, modify, merge, publish,
12
+ # distribute, sublicense, and/or sell copies of the Software, and to
13
+ # permit persons to whom the Software is furnished to do so, subject to
14
+ # the following conditions:
15
+ #
16
+ # The above copyright notice and this permission notice shall be
17
+ # included in all copies or substantial portions of the Software.
18
+ #
19
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
20
+ # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
21
+ # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
22
+ # NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
23
+ # LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
24
+ # OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
25
+ # WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
26
+
27
+ class User < ActiveRecord::Base
28
+ # Include default devise modules. Others available are:
29
+ # :confirmable, :lockable, :timeoutable and :omniauthable
30
+ devise :database_authenticatable, :registerable,
31
+ :recoverable, :rememberable, :trackable, :validatable
32
+
33
+ # Setup accessible (or protected) attributes for your model
34
+ attr_accessible :email, :password, :password_confirmation, :remember_me
35
+ # attr_accessible :title, :body
36
+ end
@@ -0,0 +1,14 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <%= stylesheet_link_tag "application", :media => "all" %>
6
+ <%= javascript_include_tag "application" %>
7
+ <%= csrf_meta_tags %>
8
+ </head>
9
+ <body>
10
+
11
+ <%= yield %>
12
+
13
+ </body>
14
+ </html>
@@ -0,0 +1,33 @@
1
+ <%= form_for(@material) do |f| %>
2
+ <% if @material.errors.any? %>
3
+ <div id="error_explanation">
4
+ <h2><%= pluralize(@material.errors.count, "error") %> prohibited this material from being saved:</h2>
5
+
6
+ <ul>
7
+ <% @material.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 :name %><br />
16
+ <%= f.text_field :name %>
17
+ </div>
18
+ <div class="field">
19
+ <%= f.label :created_user %><br />
20
+ <%= f.text_field :created_user %>
21
+ </div>
22
+ <div class="field">
23
+ <%= f.label :updated_user %><br />
24
+ <%= f.text_field :updated_user %>
25
+ </div>
26
+ <div class="field">
27
+ <%= f.label :destroy_user %><br />
28
+ <%= f.text_field :destroy_user %>
29
+ </div>
30
+ <div class="actions">
31
+ <%= f.submit %>
32
+ </div>
33
+ <% end %>
@@ -0,0 +1,6 @@
1
+
2
+ <h1>Edit material</h1>
3
+
4
+ <%= render 'form' %>
5
+
6
+ <%= link_to 'Back', materials_path %>
@@ -0,0 +1,29 @@
1
+ <h1>Listing materials</h1>
2
+
3
+ <table>
4
+ <tr>
5
+ <th>Name</th>
6
+ <th>Created user</th>
7
+ <th>Updated user</th>
8
+ <th>Destroy user</th>
9
+ <th></th>
10
+ <th></th>
11
+ <th></th>
12
+ </tr>
13
+
14
+ <% @materials.each do |material| %>
15
+ <tr>
16
+ <td><%= material.name %></td>
17
+ <td><%= material.created_user %></td>
18
+ <td><%= material.updated_user %></td>
19
+ <td><%= material.destroy_user %></td>
20
+ <td><%= link_to 'Show', material %></td>
21
+ <td><%= link_to 'Edit', edit_material_path(material) %></td>
22
+ <td><%= link_to 'Destroy', material, method: :delete, data: { confirm: 'Are you sure?' } %></td>
23
+ </tr>
24
+ <% end %>
25
+ </table>
26
+
27
+ <br />
28
+
29
+ <%= link_to 'New material', new_material_path %>