質問編集履歴
2
show.html追加しました
test
CHANGED
File without changes
|
test
CHANGED
@@ -189,3 +189,17 @@
|
|
189
189
|
|
190
190
|
|
191
191
|
```
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
```ここに言語を入力
|
196
|
+
|
197
|
+
protein show.hetml.erb
|
198
|
+
|
199
|
+
<div class="cart">
|
200
|
+
|
201
|
+
<%=link_to "カートに追加", new_cart_path(@protein), class: 'cart-item' %>
|
202
|
+
|
203
|
+
</div>
|
204
|
+
|
205
|
+
```
|
1
proteinコントローラを新たに掲載させて頂きました
test
CHANGED
File without changes
|
test
CHANGED
@@ -105,3 +105,87 @@
|
|
105
105
|
belongs_to :cart
|
106
106
|
|
107
107
|
```
|
108
|
+
|
109
|
+
|
110
|
+
|
111
|
+
```ここに言語を入力
|
112
|
+
|
113
|
+
def index
|
114
|
+
|
115
|
+
@proteins = Protein.all
|
116
|
+
|
117
|
+
end
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
def new
|
122
|
+
|
123
|
+
@protein = Protein.new
|
124
|
+
|
125
|
+
end
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
def create
|
130
|
+
|
131
|
+
@protein = Protein.new(proteins_params)
|
132
|
+
|
133
|
+
if @protein.save
|
134
|
+
|
135
|
+
redirect_to root_path
|
136
|
+
|
137
|
+
else
|
138
|
+
|
139
|
+
render :new
|
140
|
+
|
141
|
+
end
|
142
|
+
|
143
|
+
end
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
def show
|
148
|
+
|
149
|
+
end
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
def edit
|
154
|
+
|
155
|
+
end
|
156
|
+
|
157
|
+
|
158
|
+
|
159
|
+
def update
|
160
|
+
|
161
|
+
if @protein.update(proteins_params)
|
162
|
+
|
163
|
+
redirect_to protein_path
|
164
|
+
|
165
|
+
else
|
166
|
+
|
167
|
+
render :edit
|
168
|
+
|
169
|
+
end
|
170
|
+
|
171
|
+
end
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
def destroy
|
176
|
+
|
177
|
+
if @protein.destroy
|
178
|
+
|
179
|
+
redirect_to proteins_path
|
180
|
+
|
181
|
+
else
|
182
|
+
|
183
|
+
render :show
|
184
|
+
|
185
|
+
end
|
186
|
+
|
187
|
+
end
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
```
|