質問編集履歴

1

コードの追記

2018/03/24 18:24

投稿

ginger_0427
ginger_0427

スコア6

test CHANGED
File without changes
test CHANGED
@@ -47,3 +47,43 @@
47
47
  ActiveRecordを使用してできるようにしたいです。
48
48
 
49
49
  よろしくお願いします。
50
+
51
+
52
+
53
+ 追記:
54
+
55
+ scaffold 実装時と考えてもらって良いです。
56
+
57
+
58
+
59
+ ```ここに言語を入力
60
+
61
+ controllers/items_controller.rb
62
+
63
+
64
+
65
+ def index
66
+
67
+ @items = Item.all
68
+
69
+ end
70
+
71
+
72
+
73
+
74
+
75
+ views//items/index.html.erb
76
+
77
+
78
+
79
+ <% @items.each do |item| %>
80
+
81
+ <tr>
82
+
83
+ <td><%= item.no %></td>
84
+
85
+ <td><%= item.name %></td>
86
+
87
+ <td><%= item.date %></td>
88
+
89
+ ```