質問編集履歴
2
試したことを追加しました.
test
CHANGED
File without changes
|
test
CHANGED
@@ -148,6 +148,72 @@
|
|
148
148
|
|
149
149
|
|
150
150
|
|
151
|
+
**posts_controller.rb**
|
152
|
+
|
153
|
+
|
154
|
+
|
155
|
+
```
|
156
|
+
|
157
|
+
def reply
|
158
|
+
|
159
|
+
@next_dear = Post.params[:from]
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
@post = Post.new(post_params)
|
164
|
+
|
165
|
+
@post.sender_id = @post.receiver_id
|
166
|
+
|
167
|
+
@post.receiver_id = current_user.id
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
@post.save!
|
172
|
+
|
173
|
+
redirect_to posts_path
|
174
|
+
|
175
|
+
end
|
176
|
+
|
177
|
+
```
|
178
|
+
|
179
|
+
**reply.html.erb の一部**
|
180
|
+
|
181
|
+
```
|
182
|
+
|
183
|
+
<div class="form">
|
184
|
+
|
185
|
+
<div class="form-body">
|
186
|
+
|
187
|
+
<%= form.label :宛名 %><br>
|
188
|
+
|
189
|
+
<%= form.text_field :dear, value: @next_dear%>
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
<%= form.label :本文 %><br>
|
196
|
+
|
197
|
+
<%= form.text_area :content %>
|
198
|
+
|
199
|
+
|
200
|
+
|
201
|
+
<%= form.label :差出人 %><br>
|
202
|
+
|
203
|
+
<%= form.text_field :from, placeholder: "#{username}より"%>
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
<%= form.submit value="投函する" %>
|
208
|
+
|
209
|
+
</div>
|
210
|
+
|
211
|
+
</div>
|
212
|
+
|
213
|
+
```
|
214
|
+
|
215
|
+
|
216
|
+
|
151
217
|
### 補足情報(FW/ツールのバージョンなど)
|
152
218
|
|
153
219
|
|
1
タグを追加しました
test
CHANGED
File without changes
|
test
CHANGED
File without changes
|