Skip to content

Commit 39f2b07

Browse files
committed
make sure node.receiver is not nil
1 parent 6517576 commit 39f2b07

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/rails/convert_mailers_2_3_to_3_0.rb

+3-3
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def signup_notification(recipient)
114114
# Notifier.deliver_signup_notification(recipient)
115115
# =>
116116
# Notifier.signup_notification(recipient).deliver
117-
with_node node_type: 'call_node', name: /^deliver_/ do
117+
with_node node_type: 'call_node', receiver: { not: nil }, name: /^deliver_/ do
118118
mailer_method = node.name.to_s.sub(/^deliver_/, '').to_sym
119119
if mailer_methods[node.receiver.name] && mailer_methods[node.receiver.name].include?(mailer_method)
120120
replace_with "{{receiver}}.#{mailer_method}({{arguments}}).deliver"
@@ -124,7 +124,7 @@ def signup_notification(recipient)
124124
# message = Notifier.create_signup_notification(recipient)
125125
# =>
126126
# message = Notifier.signup_notification(recipient)
127-
with_node node_type: 'call_node', name: /^create_/ do
127+
with_node node_type: 'call_node', receiver: { not: nil }, name: /^create_/ do
128128
mailer_method = node.name.to_s.sub(/^create_/, '').to_sym
129129
if mailer_methods[node.receiver.name] && mailer_methods[node.receiver.name].include?(mailer_method)
130130
replace_with "{{receiver}}.#{mailer_method}({{arguments}})"
@@ -134,7 +134,7 @@ def signup_notification(recipient)
134134
# Notifier.deliver(message)
135135
# =>
136136
# message.deliver
137-
with_node node_type: 'call_node', name: 'deliver', arguments: { node_type: 'arguments_node', arguments: { size: 1 } } do
137+
with_node node_type: 'call_node', receiver: { not: nil }, name: 'deliver', arguments: { node_type: 'arguments_node', arguments: { size: 1 } } do
138138
if mailer_methods[node.receiver.name]
139139
replace_with '{{arguments}}.{{message}}'
140140
end

0 commit comments

Comments
 (0)