Skip to content

Commit

Permalink
Update initializer to use modern Ruby syntax
Browse files Browse the repository at this point in the history
This trips over a Rubocop rule on CI:

```
lib/mail/notify/railtie.rb:12:36: W: Lint/SendWithMixinArgument: Use
prepend Mail::Notify::MailersController instead of send(:prepend,
Mail::Notify::MailersController).
          Rails::MailersController.send(:prepend,
Mail::Notify::MailersController)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
```

As rubocop/rubocop#7274 explains:

> Back in the day (before Ruby 2.1), Module.include and Module.prepend
were private methods. So when people authored gems / patched monkeys,
they wrote e.g. Foo.send(:include, MyPatch). In our day and age, I
think we should encourage everybody to just write Foo.include(MyPatch).
  • Loading branch information
tijmenb committed Oct 21, 2019
1 parent 5f31c06 commit f36a53f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/mail/notify/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class Railtie < Rails::Railtie

initializer 'mail-notify.action_controller' do
ActiveSupport.on_load(:action_controller, run_once: true) do
Rails::MailersController.send(:prepend, Mail::Notify::MailersController)
Rails::MailersController.prepend(Mail::Notify::MailersController)
end
end
end
Expand Down

0 comments on commit f36a53f

Please sign in to comment.