質問編集履歴
6
タイトル変更
title
CHANGED
File without changes
|
body
CHANGED
@@ -156,4 +156,20 @@
|
|
156
156
|
.link-return
|
157
157
|
= link_to 'トップページに戻る', tweets_path
|
158
158
|
|
159
|
+
```
|
160
|
+
|
161
|
+
tweetデータベース
|
162
|
+
```rails
|
163
|
+
class CreateTweets < ActiveRecord::Migration[6.0]
|
164
|
+
def change
|
165
|
+
create_table :tweets do |t|
|
166
|
+
t.string :title
|
167
|
+
t.string :text
|
168
|
+
t.string :image
|
169
|
+
|
170
|
+
t.timestamps
|
171
|
+
end
|
172
|
+
end
|
173
|
+
end
|
174
|
+
|
159
175
|
```
|
5
文法の修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -120,4 +120,40 @@
|
|
120
120
|
@tweet.save
|
121
121
|
redirect_to blogs_path
|
122
122
|
end
|
123
|
+
```
|
124
|
+
|
125
|
+
カレンダー投稿画面 view
|
126
|
+
```haml
|
127
|
+
.blog-new
|
128
|
+
.blog-create
|
129
|
+
.carendar カレンダー投稿画面
|
130
|
+
= form_with(model: @blog, local: true) do |form|
|
131
|
+
.blog
|
132
|
+
.blog-new-create
|
133
|
+
.title
|
134
|
+
= form.label :タイトル
|
135
|
+
%br/
|
136
|
+
= form.text_field :title
|
137
|
+
.time
|
138
|
+
= form.label :日付_時間
|
139
|
+
%br/
|
140
|
+
= form.datetime_select :start_time
|
141
|
+
.content
|
142
|
+
= form.label :content
|
143
|
+
%br/
|
144
|
+
= form.text_field :content
|
145
|
+
.blog-tweet
|
146
|
+
.blog-tweet-image
|
147
|
+
= image_tag @tweet.image.url
|
148
|
+
%br/
|
149
|
+
.blog-tweet-title
|
150
|
+
= @tweet.title
|
151
|
+
%br/
|
152
|
+
.blog-tweet-title
|
153
|
+
= @tweet.text
|
154
|
+
.submit
|
155
|
+
= form.submit
|
156
|
+
.link-return
|
157
|
+
= link_to 'トップページに戻る', tweets_path
|
158
|
+
|
123
159
|
```
|
4
文法の修正
title
CHANGED
File without changes
|
body
CHANGED
@@ -104,4 +104,20 @@
|
|
104
104
|
end
|
105
105
|
|
106
106
|
end
|
107
|
+
```
|
108
|
+
|
109
|
+
コンソール画像
|
110
|
+

|
111
|
+
|
112
|
+
追記
|
113
|
+
カレンダーコントローラー変更点
|
114
|
+
```rails
|
115
|
+
def create
|
116
|
+
@blog = current_user.blogs.new(blog_parameter)
|
117
|
+
@tweet = Tweet.new(user_id: current_user.id, image: params[:image])
|
118
|
+
# params[:image]はフォームから飛んでくる画像のパラメータにする
|
119
|
+
@blog.save
|
120
|
+
@tweet.save
|
121
|
+
redirect_to blogs_path
|
122
|
+
end
|
107
123
|
```
|
3
タイトル変更
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
Mysqlデータベースに
|
1
|
+
Mysqlデータベースに保存ができない?
|
body
CHANGED
File without changes
|
2
文法の修正
title
CHANGED
File without changes
|
body
CHANGED
File without changes
|
1
文法の修正
title
CHANGED
@@ -1,1 +1,1 @@
|
|
1
|
-
Mysqlデータベースに保存を
|
1
|
+
Mysqlデータベースにデータを保存をしたい。
|
body
CHANGED
File without changes
|