質問編集履歴

1

追加コード

2019/02/14 05:52

投稿

Casablanca_mtg
Casablanca_mtg

スコア209

test CHANGED
File without changes
test CHANGED
@@ -128,6 +128,92 @@
128
128
 
129
129
  ```
130
130
 
131
+ ```edit.html.erb
132
+
133
+ <h2>Edit Post</h2>
134
+
135
+ <%= form_for :post, url: post_path(@post) do |f| %>
136
+
137
+ <p>
138
+
139
+ <%= f.text_field :title, placeholder: 'enter title' %>
140
+
141
+ <% if @post.errors.messages[:title].any? %>
142
+
143
+ <span class="error"><%= @post.errors.messages[:title][0] %></span>
144
+
145
+ <% end %>
146
+
147
+ </p>
148
+
149
+
150
+
151
+ <p>
152
+
153
+ <%= f.text_area :body, placeholder: 'enter body text' %>
154
+
155
+ <% if @post.errors.messages[:body].any? %>
156
+
157
+ <span class="error"><%= @post.errors.messages[:body][0] %></span>
158
+
159
+ <% end %>
160
+
161
+ </p>
162
+
163
+
164
+
165
+ <p>
166
+
167
+ <%= f.submit %>
168
+
169
+ </p>
170
+
171
+ <% end %>
172
+
173
+
174
+
175
+ ```
176
+
177
+ ```_form.html.erb
178
+
179
+ <%= form_for @post do |f| %>
180
+
181
+ <p>
182
+
183
+ <%= f.text_field :title, placeholder: 'enter title' %>
184
+
185
+ <% if @post.errors.messages[:title].any? %>
186
+
187
+ <span class="error"><%= @post.errors.messages[:title][0] %></span>
188
+
189
+ <% end %>
190
+
191
+ </p>
192
+
193
+ <p>
194
+
195
+ <%= f.text_area :body, placeholder: 'enter body text' %>
196
+
197
+ <% if @post.errors.messages[:body].any? %>
198
+
199
+ <span class="error"><%= @post.errors.messages[:body][0] %></span>
200
+
201
+ <% end %>
202
+
203
+ </p>
204
+
205
+ <p>
206
+
207
+ <%= f.submit %>
208
+
209
+ </p>
210
+
211
+ <% end %>
212
+
213
+
214
+
215
+ ```
216
+
131
217
  以上となっています
132
218
 
133
219
  修正方法はどのようにやればいいですか>