質問編集履歴
1
追加の情報
title
CHANGED
File without changes
|
body
CHANGED
@@ -9,4 +9,34 @@
|
|
9
9
|
SocketError (getaddrinfo: 名前またはサービスが不明です)
|
10
10
|
とエラーになります。
|
11
11
|
|
12
|
-
どう対処したらいいですか?
|
12
|
+
どう対処したらいいですか?
|
13
|
+
|
14
|
+
|
15
|
+
追記
|
16
|
+
|
17
|
+
記事を投稿する際にエラーが起こります。(記事は保存されます)
|
18
|
+
メールのセッティングは
|
19
|
+
app/meilers/post_mailer.rb
|
20
|
+
|
21
|
+
default from: "from@example.com"
|
22
|
+
def post_email(user,post)
|
23
|
+
@user = user
|
24
|
+
mail to: "@user.email", subject: "記事を投稿しました。"
|
25
|
+
end
|
26
|
+
|
27
|
+
app/Views/post_mailer/post_email.html.erb
|
28
|
+
app/Views/post_mailer/post_email.text.erb
|
29
|
+
こちらは参考にしたサイトと全く一緒です。
|
30
|
+
|
31
|
+
controllers/posts_controller.rb
|
32
|
+
def create
|
33
|
+
@user=current_user
|
34
|
+
@post =Post.new(post_params)
|
35
|
+
@post.user_id = @user.id
|
36
|
+
if @post.save
|
37
|
+
PostMailer.post_email(@user,@post).deliver
|
38
|
+
redirect_to posts_path
|
39
|
+
else
|
40
|
+
render :new
|
41
|
+
end
|
42
|
+
end
|