質問編集履歴

1

createアクション追加

2020/10/16 03:37

投稿

bata1016
bata1016

スコア2

test CHANGED
File without changes
test CHANGED
@@ -64,6 +64,70 @@
64
64
 
65
65
  ```
66
66
 
67
+ ```ここに言語を入力
68
+
69
+ app/controllers/user_mailers_controller.rb
70
+
71
+ class UserMailersController < ApplicationController
72
+
73
+ def new
74
+
75
+ @folder = Folder.find(params[:folder_id])
76
+
77
+ @document = Document.find(params[:document_id])
78
+
79
+ @user_name = current_user.name
80
+
81
+ @user_mail = current_user.email
82
+
83
+ document = Document.find(params[:document_id])
84
+
85
+ @images = document.images
86
+
87
+ end
88
+
89
+
90
+
91
+ def create
92
+
93
+ user_mail = current_user.email
94
+
95
+ document = Document.find(params[:document_id])
96
+
97
+ images = document.images
98
+
99
+ binding.pry
100
+
101
+ if UserMailer.send_email(email_params, user_mail, images)
102
+
103
+ redirect_to root_path
104
+
105
+ else
106
+
107
+ render :new
108
+
109
+ end
110
+
111
+
112
+
113
+ end
114
+
115
+
116
+
117
+ private
118
+
119
+ def email_params
120
+
121
+ params.permit(:send_email, :subject, :message)
122
+
123
+ end
124
+
125
+
126
+
127
+ end
128
+
129
+ ```
130
+
67
131
  ```
68
132
 
69
133
  app/views/user_mailers/new.html.erb