1
0
Fork 0
mirror of https://github.com/heartcombo/devise.git synced 2022-11-09 12:18:31 -05:00

Remove ActionMailer/ActiveJob deprecation.

This commit is contained in:
Lucas Mazza 2014-09-02 14:50:57 -03:00
parent 13eebb6b76
commit c25312e78e
2 changed files with 19 additions and 1 deletions

View file

@ -471,6 +471,18 @@ Alternatively, you can simply run the Devise generator.
Keep in mind that those models will have completely different routes. They **do not** and **cannot** share the same controller for sign in, sign out and so on. In case you want to have different roles sharing the same actions, we recommend you to use a role-based approach, by either providing a role column or using a dedicated gem for authorization.
### ActiveJob Integration
If you are using Rails 4.2 and ActiveJob to deliver ActionMailer messages in the
background through a queueing backend, you can send Devise emails through your
existing queue by overriding the `send_devise_notification` method in your model.
```ruby
def send_devise_notification(notification, *args)
devise_mailer.send(notification, self, *args).deliver_later
end
```
### Other ORMs
Devise supports ActiveRecord (default) and Mongoid. To choose other ORM, you just need to require it in the initializer file.

View file

@ -170,7 +170,13 @@ module Devise
# end
#
def send_devise_notification(notification, *args)
devise_mailer.send(notification, self, *args).deliver
message = devise_mailer.send(notification, self, *args)
# Remove once we move to Rails 4.2+ only.
if message.respond_to?(:deliver_now)
message.deliver_now
else
message.deliver
end
end
def downcase_keys