Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Active Job with Rails 4 and Devise

I am trying to set up Active Job with Rails 4 and Devise. I'm open to any tutorial, if there is any (couldn't find through my searching.)

I know there is a Devise Async gem, but it does not cover Active Job in it. That said, I found this gem that is fresh in development, but I'm getting an uninitialized constant Devise::Async::Backend::Base (NameError)error. (Could be me being airy on implementing it).

Any suggestions are welcomed. I'm hoping I don't have to create new controller methods.

like image 381
AGirlThatCodes Avatar asked Dec 17 '14 03:12

AGirlThatCodes


People also ask

What are active jobs in Rails?

Active Job is a framework for declaring jobs and making them run on a variety of queuing backends. These jobs can be everything from regularly scheduled clean-ups, to billing charges, to mailings. Anything that can be chopped up into small units of work and run in parallel, really.

What is Rails Devise?

Devise is an excellent authentication system made for Rails that allows us to easily drop-in User functionality into our project. Devise only includes an email and password for registration, let's also add our own username to our User model. We also want to have a unique index on our username.


1 Answers

You can include the following code in your desired model (normally User):

def send_devise_notification(notification, *args)
  devise_mailer.send(notification, self, *args).deliver_later
end

You can take a look at the following page for more detail: http://www.sitepoint.com/devise-authentication-in-depth/

like image 149
mrstif Avatar answered Oct 14 '22 05:10

mrstif