質問編集履歴
2
試したことを追加しました.
title
CHANGED
File without changes
|
body
CHANGED
@@ -73,6 +73,39 @@
|
|
73
73
|
|
74
74
|
もともとのform_withで入力された内容 (タイトル)をplaceholderないしはデフォルトで表示させられるのかなとも思ったのですが, 見つけられなかったので質問させていただきました.
|
75
75
|
|
76
|
+
**posts_controller.rb**
|
77
|
+
|
78
|
+
```
|
79
|
+
def reply
|
80
|
+
@next_dear = Post.params[:from]
|
81
|
+
|
82
|
+
@post = Post.new(post_params)
|
83
|
+
@post.sender_id = @post.receiver_id
|
84
|
+
@post.receiver_id = current_user.id
|
85
|
+
|
86
|
+
@post.save!
|
87
|
+
redirect_to posts_path
|
88
|
+
end
|
89
|
+
```
|
90
|
+
**reply.html.erb の一部**
|
91
|
+
```
|
92
|
+
<div class="form">
|
93
|
+
<div class="form-body">
|
94
|
+
<%= form.label :宛名 %><br>
|
95
|
+
<%= form.text_field :dear, value: @next_dear%>
|
96
|
+
|
97
|
+
|
98
|
+
<%= form.label :本文 %><br>
|
99
|
+
<%= form.text_area :content %>
|
100
|
+
|
101
|
+
<%= form.label :差出人 %><br>
|
102
|
+
<%= form.text_field :from, placeholder: "#{username}より"%>
|
103
|
+
|
104
|
+
<%= form.submit value="投函する" %>
|
105
|
+
</div>
|
106
|
+
</div>
|
107
|
+
```
|
108
|
+
|
76
109
|
### 補足情報(FW/ツールのバージョンなど)
|
77
110
|
|
78
111
|
ruby 2.6.5
|
1
タグを追加しました
title
CHANGED
File without changes
|
body
CHANGED
File without changes
|