質問編集履歴

2

ViewとMailerの追加

2019/09/26 03:51

投稿

hassan2019
hassan2019

スコア15

test CHANGED
File without changes
test CHANGED
@@ -14,7 +14,7 @@
14
14
 
15
15
  ### 該当のソースコード
16
16
 
17
-
17
+ Controller
18
18
 
19
19
  ```Ruby
20
20
 
@@ -22,7 +22,47 @@
22
22
 
23
23
  ```
24
24
 
25
+ Mailer
25
26
 
27
+ ```Ruby
28
+
29
+ class SomthingMailer < ApplicationMailer
30
+
31
+ def something_notice(param1, param2, param3, param4)
32
+
33
+ @param1 = param1
34
+
35
+ @param2 = param2
36
+
37
+ @param3 = param3
38
+
39
+ @param4 = param4
40
+
41
+
42
+
43
+ @subject = "メールタイトルは#{@param1}です"
44
+
45
+ mail subject: @param1, to: @param2, cc: @param3, from: "#{@param3.name} <test@com>", &:text
46
+
47
+ end
48
+
49
+ end
50
+
51
+ ```
52
+
53
+
54
+
55
+ View
56
+
57
+ ```Haml
58
+
59
+ #{param2.name 'さん'}
60
+
61
+ #{param4}
62
+
63
+ = render 'mailer/footer'
64
+
65
+ ```
26
66
 
27
67
  ruby 2.5.3
28
68
 

1

クラス名を変更

2019/09/26 03:51

投稿

hassan2019
hassan2019

スコア15

test CHANGED
File without changes
test CHANGED
@@ -18,7 +18,7 @@
18
18
 
19
19
  ```Ruby
20
20
 
21
- AssignMailer.notice(@param1, @param2,@param3, @param4).deliver_later
21
+ SomthingMailer.notice(@param1, @param2,@param3, @param4).deliver_later
22
22
 
23
23
  ```
24
24