質問編集履歴
6
タイトル変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -315,3 +315,35 @@
|
|
315
315
|
|
316
316
|
|
317
317
|
```
|
318
|
+
|
319
|
+
|
320
|
+
|
321
|
+
tweetデータベース
|
322
|
+
|
323
|
+
```rails
|
324
|
+
|
325
|
+
class CreateTweets < ActiveRecord::Migration[6.0]
|
326
|
+
|
327
|
+
def change
|
328
|
+
|
329
|
+
create_table :tweets do |t|
|
330
|
+
|
331
|
+
t.string :title
|
332
|
+
|
333
|
+
t.string :text
|
334
|
+
|
335
|
+
t.string :image
|
336
|
+
|
337
|
+
|
338
|
+
|
339
|
+
t.timestamps
|
340
|
+
|
341
|
+
end
|
342
|
+
|
343
|
+
end
|
344
|
+
|
345
|
+
end
|
346
|
+
|
347
|
+
|
348
|
+
|
349
|
+
```
|
5
文法の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -243,3 +243,75 @@
|
|
243
243
|
end
|
244
244
|
|
245
245
|
```
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
カレンダー投稿画面 view
|
250
|
+
|
251
|
+
```haml
|
252
|
+
|
253
|
+
.blog-new
|
254
|
+
|
255
|
+
.blog-create
|
256
|
+
|
257
|
+
.carendar カレンダー投稿画面
|
258
|
+
|
259
|
+
= form_with(model: @blog, local: true) do |form|
|
260
|
+
|
261
|
+
.blog
|
262
|
+
|
263
|
+
.blog-new-create
|
264
|
+
|
265
|
+
.title
|
266
|
+
|
267
|
+
= form.label :タイトル
|
268
|
+
|
269
|
+
%br/
|
270
|
+
|
271
|
+
= form.text_field :title
|
272
|
+
|
273
|
+
.time
|
274
|
+
|
275
|
+
= form.label :日付_時間
|
276
|
+
|
277
|
+
%br/
|
278
|
+
|
279
|
+
= form.datetime_select :start_time
|
280
|
+
|
281
|
+
.content
|
282
|
+
|
283
|
+
= form.label :content
|
284
|
+
|
285
|
+
%br/
|
286
|
+
|
287
|
+
= form.text_field :content
|
288
|
+
|
289
|
+
.blog-tweet
|
290
|
+
|
291
|
+
.blog-tweet-image
|
292
|
+
|
293
|
+
= image_tag @tweet.image.url
|
294
|
+
|
295
|
+
%br/
|
296
|
+
|
297
|
+
.blog-tweet-title
|
298
|
+
|
299
|
+
= @tweet.title
|
300
|
+
|
301
|
+
%br/
|
302
|
+
|
303
|
+
.blog-tweet-title
|
304
|
+
|
305
|
+
= @tweet.text
|
306
|
+
|
307
|
+
.submit
|
308
|
+
|
309
|
+
= form.submit
|
310
|
+
|
311
|
+
.link-return
|
312
|
+
|
313
|
+
= link_to 'トップページに戻る', tweets_path
|
314
|
+
|
315
|
+
|
316
|
+
|
317
|
+
```
|
4
文法の修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -211,3 +211,35 @@
|
|
211
211
|
end
|
212
212
|
|
213
213
|
```
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
コンソール画像
|
218
|
+
|
219
|
+
![イメージ説明](25377c09268c8b0fdf8df9706e99015a.png)
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
追記
|
224
|
+
|
225
|
+
カレンダーコントローラー変更点
|
226
|
+
|
227
|
+
```rails
|
228
|
+
|
229
|
+
def create
|
230
|
+
|
231
|
+
@blog = current_user.blogs.new(blog_parameter)
|
232
|
+
|
233
|
+
@tweet = Tweet.new(user_id: current_user.id, image: params[:image])
|
234
|
+
|
235
|
+
# params[:image]はフォームから飛んでくる画像のパラメータにする
|
236
|
+
|
237
|
+
@blog.save
|
238
|
+
|
239
|
+
@tweet.save
|
240
|
+
|
241
|
+
redirect_to blogs_path
|
242
|
+
|
243
|
+
end
|
244
|
+
|
245
|
+
```
|
3
タイトル変更
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Mysqlデータベースに
|
1
|
+
Mysqlデータベースに保存ができない?
|
test
CHANGED
File without changes
|
2
文法の修正
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|
1
文法の修正
test
CHANGED
@@ -1 +1 @@
|
|
1
|
-
Mysqlデータベースに保存を
|
1
|
+
Mysqlデータベースにデータを保存をしたい。
|
test
CHANGED
File without changes
|